)]}'
{
  "commit": "17a5f24e0a8ec22f74399764db30d97ae310f3c6",
  "tree": "8842120c5bcf3a9fc56f7a6250176b1d58133c5a",
  "parents": [
    "138f2df1e3c00183ca20d04e5084fcf4d34f330d"
  ],
  "author": {
    "name": "Harald van Dijk",
    "email": "harald@gigawatt.nl",
    "time": "Tue Jun 07 16:35:41 2016 +0800"
  },
  "committer": {
    "name": "Herbert Xu",
    "email": "herbert@gondor.apana.org.au",
    "time": "Tue Jun 07 16:35:41 2016 +0800"
  },
  "message": "eval: Fix exit status when calling eval/dot with no commands\n\nOn 17/11/2015 03:18, Gioele Barabucci wrote:\n\u003e Hello,\n\u003e\n\u003e a bug has been filed in the Debian BTS about dash not resetting the exit\n\u003e status after sourcing an empty file with the dot command. [1]\n\u003e\n\u003e The following test echoes \"OK\" with bash and \"fail\" with dash\n\u003e\n\u003e      #!/bin/sh\n\u003e\n\u003e      echo \u003e ./empty\n\u003e      false\n\u003e\n\u003e      . ./empty \u0026\u0026 echo \"OK\" || echo \"fail\"\n \u003e\n\u003e A similar bug in dash has been discussed and addressed in 2011 [2], but\n\u003e it looks like the solution has been only partial.\n\u003e\n\u003e The version of dash I tested is the current git master branch, commit\n\u003e 2e58422.\n\u003e\n\u003e [1] https://bugs.debian.org/777262\n\u003e [2] http://article.gmane.org/gmane.comp.shells.dash/531\n\nThe bug described there was about empty files. While the fix has been \napplied and does make dash handle empty files properly, your test \ndoesn\u0027t use an empty file, it uses a file containing a single blank \nline. Unfortunately, the single blank line gets parsed by dash as a null \ncommand, null commands don\u0027t (and shouldn\u0027t) reset the exit status, and \nthe fix you link to doesn\u0027t handle this because it sees a command has \nbeen executed and saves the exit status after executing that command as \nthe exit status to be used by \".\".\n\nI think the easiest way to fix this is to prevent null commands from \naffecting status in cmdloop, as attached.\n\nAn alternative could be to change the outer if condition to exclude\nn \u003d\u003d NULL, but I didn\u0027t do that because the change of job_warning and \nclearing of numeof make sense to me even for null commands. Besides, \nwhen debug tracing is enabled, null commands have a visible effect that \nshould remain.\n\nNote that this fixes the problem with . but the same problem can be \npresent in other locations. For example,\n\n     false\n     eval \"\n     \" \u0026\u0026 echo OK || echo Fail\n\nused to print Fail, and needed the same modification in the evalstring \nfunction to make that print OK (included in the attached patch). There \nmay be other similar bugs lurking.\n\nSigned-off-by: Herbert Xu \u003cherbert@gondor.apana.org.au\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "071fb1be1c512de37bb39edd1180c6af7f0ac284",
      "old_mode": 33188,
      "old_path": "src/eval.c",
      "new_id": "30c05f937d95d042d645741f82240f5564856092",
      "new_mode": 33188,
      "new_path": "src/eval.c"
    },
    {
      "type": "modify",
      "old_id": "bedb663544d55ce298d2e65ad8abc9b9688549b8",
      "old_mode": 33188,
      "old_path": "src/main.c",
      "new_id": "497ac16041ed8b82647429330b0603a974a0ec3f",
      "new_mode": 33188,
      "new_path": "src/main.c"
    }
  ]
}
