{"payload":{"feedbackUrl":"https://github.com/orgs/community/discussions/53140","repo":{"id":150432966,"defaultBranch":"master","name":"libdash","ownerLogin":"binpash","currentUserCanPush":false,"isFork":false,"isEmpty":false,"createdAt":"2018-09-26T13:41:37.000Z","ownerAvatar":"https://avatars.githubusercontent.com/u/87086014?v=4","public":true,"private":false,"isOrgOwned":true},"refInfo":{"name":"","listCacheKey":"v0:1707062593.0","currentOid":""},"activityList":{"items":[{"before":"682ab71790636bb83290cabeb3d4f54eeb66534a","after":null,"ref":"refs/heads/dune-9773","pushedAt":"2024-02-04T16:03:13.000Z","pushType":"branch_deletion","commitsCount":0,"pusher":{"login":"mgree","name":"Michael Greenberg","path":"/mgree","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/505088?s=80&v=4"}},{"before":"c805325bf51671fdf9e4ba11c2fb2f5c77f0bf2a","after":"a39be0eb1ade6a569d9ce5dcfe4189617628917a","ref":"refs/heads/master","pushedAt":"2024-02-04T16:03:08.000Z","pushType":"pr_merge","commitsCount":1,"pusher":{"login":"mgree","name":"Michael Greenberg","path":"/mgree","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/505088?s=80&v=4"},"commit":{"message":"Rename libdash library to avoid name collision in dune (#29)\n\nfix from https://github.com/ocaml/dune/issues/9773","shortMessageHtmlLink":"Rename libdash library to avoid name collision in dune (#29)"}},{"before":null,"after":"682ab71790636bb83290cabeb3d4f54eeb66534a","ref":"refs/heads/dune-9773","pushedAt":"2024-01-23T15:36:10.000Z","pushType":"branch_creation","commitsCount":0,"pusher":{"login":"mgree","name":"Michael Greenberg","path":"/mgree","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/505088?s=80&v=4"},"commit":{"message":"attempt fix from https://github.com/ocaml/dune/issues/9773","shortMessageHtmlLink":"attempt fix from ocaml/dune#9773"}},{"before":null,"after":"e39dc8dd5465834670f69952329c6681f0a50d70","ref":"refs/heads/ocaml-ctypes-take2","pushedAt":"2023-12-21T14:32:56.000Z","pushType":"branch_creation","commitsCount":0,"pusher":{"login":"mgree","name":"Michael Greenberg","path":"/mgree","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/505088?s=80&v=4"},"commit":{"message":"playing with ctypes per emillon","shortMessageHtmlLink":"playing with ctypes per emillon"}},{"before":"9e953f6d560217489cfb7c9b713cce5c5dc43d7e","after":null,"ref":"refs/heads/ocaml-static-ctypes","pushedAt":"2023-12-19T18:18:40.000Z","pushType":"branch_deletion","commitsCount":0,"pusher":{"login":"mgree","name":"Michael Greenberg","path":"/mgree","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/505088?s=80&v=4"}},{"before":"4928fc1187826887895b20201ea7db1341fb00f6","after":"c805325bf51671fdf9e4ba11c2fb2f5c77f0bf2a","ref":"refs/heads/master","pushedAt":"2023-12-19T18:18:33.000Z","pushType":"pr_merge","commitsCount":1,"pusher":{"login":"mgree","name":"Michael Greenberg","path":"/mgree","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/505088?s=80&v=4"},"commit":{"message":"Static `ctypes`; building with `dune` (#28)\n\nSigned-off-by: Michael Greenberg ","shortMessageHtmlLink":"Static ctypes; building with dune (#28)"}},{"before":"7037dbd8010c3bddb9ded0b3d6482a9e6f20806b","after":"9e953f6d560217489cfb7c9b713cce5c5dc43d7e","ref":"refs/heads/ocaml-static-ctypes","pushedAt":"2023-12-19T15:55:17.000Z","pushType":"push","commitsCount":1,"pusher":{"login":"mgree","name":"Michael Greenberg","path":"/mgree","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/505088?s=80&v=4"},"commit":{"message":"use opam, not dune","shortMessageHtmlLink":"use opam, not dune"}},{"before":"3d74b5e6da6f0332020da0fa93b8bf34e635545a","after":"7037dbd8010c3bddb9ded0b3d6482a9e6f20806b","ref":"refs/heads/ocaml-static-ctypes","pushedAt":"2023-12-19T15:48:44.000Z","pushType":"push","commitsCount":1,"pusher":{"login":"mgree","name":"Michael Greenberg","path":"/mgree","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/505088?s=80&v=4"},"commit":{"message":"trying leaving out foreign archives","shortMessageHtmlLink":"trying leaving out foreign archives"}},{"before":"b0e1ac94355f57240eab32e49205e5ca41e856a4","after":"3d74b5e6da6f0332020da0fa93b8bf34e635545a","ref":"refs/heads/ocaml-static-ctypes","pushedAt":"2023-12-19T15:32:50.000Z","pushType":"push","commitsCount":1,"pusher":{"login":"mgree","name":"Michael Greenberg","path":"/mgree","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/505088?s=80&v=4"},"commit":{"message":"try building in ci","shortMessageHtmlLink":"try building in ci"}},{"before":"f823f48e232ab42093df206c3840ef921f91c732","after":"b0e1ac94355f57240eab32e49205e5ca41e856a4","ref":"refs/heads/ocaml-static-ctypes","pushedAt":"2023-12-19T14:50:02.000Z","pushType":"push","commitsCount":1,"pusher":{"login":"mgree","name":"Michael Greenberg","path":"/mgree","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/505088?s=80&v=4"},"commit":{"message":"send dunes","shortMessageHtmlLink":"send dunes"}},{"before":"893b1f2216d01e46fe6d50a458d386b5341a7cbf","after":"f823f48e232ab42093df206c3840ef921f91c732","ref":"refs/heads/ocaml-static-ctypes","pushedAt":"2023-12-19T14:40:32.000Z","pushType":"push","commitsCount":1,"pusher":{"login":"mgree","name":"Michael Greenberg","path":"/mgree","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/505088?s=80&v=4"},"commit":{"message":"tests in dune, fixup ci","shortMessageHtmlLink":"tests in dune, fixup ci"}},{"before":"7b4e2a5587f9593959b6356d905d57a13c5016da","after":"893b1f2216d01e46fe6d50a458d386b5341a7cbf","ref":"refs/heads/ocaml-static-ctypes","pushedAt":"2023-12-19T14:14:39.000Z","pushType":"push","commitsCount":1,"pusher":{"login":"mgree","name":"Michael Greenberg","path":"/mgree","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/505088?s=80&v=4"},"commit":{"message":"use standard opam dune build","shortMessageHtmlLink":"use standard opam dune build"}},{"before":null,"after":"7b4e2a5587f9593959b6356d905d57a13c5016da","ref":"refs/heads/ocaml-static-ctypes","pushedAt":"2023-12-15T01:07:19.000Z","pushType":"branch_creation","commitsCount":0,"pusher":{"login":"mgree","name":"Michael Greenberg","path":"/mgree","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/505088?s=80&v=4"},"commit":{"message":"like lawrence before me, i have conquered the dunes","shortMessageHtmlLink":"like lawrence before me, i have conquered the dunes"}},{"before":"5b15fe94b7d560ec80d13ce1b2049e283646453c","after":null,"ref":"refs/heads/merge-v0.5.12","pushedAt":"2023-12-14T14:08:46.000Z","pushType":"branch_deletion","commitsCount":0,"pusher":{"login":"mgree","name":"Michael Greenberg","path":"/mgree","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/505088?s=80&v=4"}},{"before":"d6f2e0dc5e05199e852bdd03db1d086547ddc70f","after":"4928fc1187826887895b20201ea7db1341fb00f6","ref":"refs/heads/master","pushedAt":"2023-12-14T14:08:42.000Z","pushType":"pr_merge","commitsCount":1,"pusher":{"login":"mgree","name":"Michael Greenberg","path":"/mgree","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/505088?s=80&v=4"},"commit":{"message":"Merge v0.5.12 from upstream (#27)\n\n* options: Do not set commandname in procargs\r\n\r\nWe set commandname in procargs when we don't have to. This results\r\nin a duplicated output of arg0 when an error occurs.\r\n\r\nReported-by: Olivier Duclos \r\nSigned-off-by: Herbert Xu \r\n\r\n* expand: Fix double-decrement in argstr\r\n\r\nDue to a double decrement in argstr we may miss field separators\r\nat the end of a word in certain situations.\r\n\r\nReported-by: Martijn Dekker \r\nFixes: 3cd538634f71 (\"expand: Do not reprocess data when...\")\r\nSigned-off-by: Herbert Xu \r\n\r\n* eval: Reset handler when entering a subshell\r\n\r\nAs it is a subshell can execute code that is only meant for the\r\nparent shell when it executes a longjmp that is caught by something\r\nlike evalcommand. This patch fixes it by resetting the handler\r\nwhen entering a subshell.\r\n\r\nReported-by: Martijn Dekker \r\nSigned-off-by: Herbert Xu \r\n\r\n* parser: Fix old-style command substitution here-document crash\r\n\r\nOn Wed, Jul 25, 2018 at 12:38:27PM +0000, project-repo wrote:\r\n> Hi,\r\n> I am working on a project in which I use the honggfuzz fuzzer to fuzz open\r\n> source software and I decided to fuzz dash. In doing so I discovered a\r\n> NULL pointer dereference in src/redir.ch on line 305. Following is a\r\n> backtrace as supplied by the address sanitizer:\r\n>\r\n> AddressSanitizer:DEADLYSIGNAL\r\n> =================================================================\r\n> ==39623==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000010 (pc 0x0000005768ed bp 0x7ffc00273df0 sp 0x7ffc00273c60 T0)\r\n> ==39623==The signal is caused by a READ memory access.\r\n> ==39623==Hint: address points to the zero page.\r\n> #0 0x5768ec in openhere /home/jfe/dash/src/redir.c:305:29\r\n> #1 0x574d92 in openredirect /home/jfe/dash/src/redir.c:230:7\r\n> #2 0x5737fe in redirect /home/jfe/dash/src/redir.c:121:11\r\n> #3 0x576017 in redirectsafe /home/jfe/dash/src/redir.c:424:3\r\n> #4 0x522326 in evalcommand /home/jfe/dash/src/eval.c:828:11\r\n> #5 0x520010 in evaltree /home/jfe/dash/src/eval.c:288:12\r\n> #6 0x5270da in evaltreenr /home/jfe/dash/src/eval.c:332:2\r\n> #7 0x526f04 in evalbackcmd /home/jfe/dash/src/eval.c:640:3\r\n> #8 0x539020 in expbackq /home/jfe/dash/src/expand.c:522:2\r\n> #9 0x5332d7 in argstr /home/jfe/dash/src/expand.c:343:4\r\n> #10 0x5322f7 in expandarg /home/jfe/dash/src/expand.c:196:2\r\n> #11 0x528118 in fill_arglist /home/jfe/dash/src/eval.c:659:3\r\n> #12 0x5213b6 in evalcommand /home/jfe/dash/src/eval.c:769:13\r\n> #13 0x520010 in evaltree /home/jfe/dash/src/eval.c:288:12\r\n> #14 0x554423 in cmdloop /home/jfe/dash/src/main.c:234:8\r\n> #15 0x553bcc in main /home/jfe/dash/src/main.c:176:3\r\n> #16 0x7f201c2b2a86 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21a86)\r\n> #17 0x41dfb9 in _start (/home/jfe/dash/src/dash+0x41dfb9)\r\n>\r\n> AddressSanitizer can not provide additional info.\r\n> SUMMARY: AddressSanitizer: SEGV /home/jfe/dash/src/redir.c:305:29 in openhere\r\n> ==39623==ABORTING\r\n>\r\n> This bug can be reproduced by running \"dash < min\" where min is þhe file\r\n> attached. I was able to reproduce this bug with the current git version\r\n> and the current debian version.\r\n>\r\n> cheers\r\n> project-repo\r\n>\r\n> < `<\r\nFixes: 51e2d88d6e51 (\"parser: Save/restore here-documents in...\")\r\nSigned-off-by: Herbert Xu \r\n\r\n* expand: Fix trailing newlines processing in backquote expanding\r\n\r\nAccording to POSIX.1-2008 we should remove newlines only at the end of\r\nthe substitution. Newlines-only substitions causes dash to remove\r\nnewlines before beggining of the substitution. The following code:\r\n\r\n cat <2\" instead of expected \"12\".\r\n\r\nThis patch fixes trailing newlines processing in backquote expanding.\r\n\r\nSigned-off-by: Nikolai Merinov \r\nSigned-off-by: Herbert Xu \r\n\r\n* parser: Only accept single-digit parameter expansion outside of braces\r\n\r\nOn Thu, Apr 25, 2019 at 01:39:52AM +0000, Michael Orlitzky wrote:\r\n> The POSIX spec says,\r\n>\r\n> The parameter name or symbol can be enclosed in braces, which are\r\n> optional except for positional parameters with more than one digit or\r\n> when parameter is a name and is followed by a character that could be\r\n> interpreted as part of the name.\r\n>\r\n> However, dash seems to diverge from that behavior when we get to $10:\r\n>\r\n> $ cat test.sh\r\n> echo $10\r\n>\r\n> $ dash ./test.sh one two three four five six seven eight nine ten\r\n> ten\r\n>\r\n> $ bash ./test.sh one two three four five six seven eight nine ten\r\n> one0\r\n\r\nThis patch should fix the problem.\r\n\r\nSigned-off-by: Herbert Xu \r\n\r\n* shell: delete AC_PROG_YACC\r\n\r\nSigned-off-by: Herbert Xu \r\n\r\n* redir: Clear saved redirections in subshell\r\n\r\nWhen we enter a subshell we need to drop the saved redirections\r\nas otherwise a subsequent unwindredir could produce incorrect\r\nresults.\r\n\r\nThis patch does this by simply clearing redirlist. While we\r\ncould actually free the memory underneath for subshells it isn't\r\nreally worth the trouble for now.\r\n\r\nIn order to ensure that this is done in every place where we enter\r\na subshell, this patch adds a new mkinit hook called forkreset.\r\nThe calls closescript, clear_traps and reset_handler are also added\r\nto the forkreset hook.\r\n\r\nThis fixes a bug where the first two functions weren't called\r\nif we enter a subshell without forking.\r\n\r\nReported-by: Harald van Dijk \r\nSigned-off-by: Herbert Xu \r\n\r\n* builtin: Fix seconds part of times(1)\r\n\r\nThe seconds part of the times(1) built-in is wrong as it does not\r\nexclude the minutes part of the result. This patch fixes it.\r\n\r\nThis problem was first noted by Michael Greenberg who also sent\r\na similar patch.\r\n\r\nReported-by: Michael Greenberg \r\nSigned-off-by: Herbert Xu \r\n\r\n* jobs: Rename DOWAIT_NORMAL to DOWAIT_NONBLOCK\r\n\r\nTo make it clearer what it is doing: nonblocking wait()\r\n\r\nSigned-off-by: Denys Vlasenko \r\nSigned-off-by: Herbert Xu \r\n\r\n* var: Remove poplocalvars() always-zero argument, make it static\r\n\r\nSigned-off-by: Denys Vlasenko \r\nSigned-off-by: Herbert Xu \r\n\r\n* jobs: Fix infinite loop in waitproc\r\n\r\nAfter we changed the resetting of gotsigchld so that it is only\r\ndone if jp is NULL, we can now get an infinite loop in waitproc\r\nif gotsigchld is set but there is no outstanding child because\r\neverything had been waited for previously without gotsigchld being\r\nzeroed.\r\n\r\nThis patch fixes it by always zeroing gotsigchld as we did before.\r\nThe bug that the previous patch was trying to fix is now resolved\r\nby switching the blocking mode to DOWAIT_NORMAL after the specified\r\njob has been completed so that we really do wait for all outstanding\r\ndead children.\r\n\r\nReported-by: Harald van Dijk \r\nFixes: 6c691b3e5099 (\"jobs: Only clear gotsigchld when waiting...\")\r\nSigned-off-by: Herbert Xu \r\n\r\n* parser: Fix handling of empty aliases\r\n\r\nDash was incorrectly handling empty aliases. When attempting to use an\r\nempty alias with nothing else, I'm (incorrectly) prompted for more\r\ninput:\r\n\r\n```\r\n$ alias empty=''\r\n$ empty\r\n>\r\n```\r\n\r\nOther shells (e.g., bash, yash) correctly handle the lone, empty alias as an\r\nempty command:\r\n\r\n```\r\n$ alias empty=''\r\n$ empty\r\n$\r\n```\r\n\r\nThe problem here is that we incorrectly enter the loop eating TNLs\r\nin readtoken(). This patch fixes it by setting checkkwd correctly.\r\n\r\nReported-by: Michael Greenberg \r\nSigned-off-by: Herbert Xu \r\n\r\n* parser: Catch errors in expandstr\r\n\r\nOn Fri, Dec 13, 2019 at 02:51:34PM +0000, Simon Ser wrote:\r\n> Just noticed another dash bug: when setting invalid PS1 values dash\r\n> enters an infinite loop.\r\n>\r\n> For instance, setting PS1='$(' makes dash print many of these:\r\n>\r\n> dash: 1: Syntax error: end of file unexpected (expecting \")\")\r\n>\r\n> It would be nice to fallback to the default PS1 value on error.\r\n\r\nThis patch fixes it by using the literal value of PS1 should an\r\nerror occur during expansion.\r\n\r\nOn Wed, Feb 26, 2020 at 09:12:04PM +0000, Ron Yorston wrote:\r\n>\r\n> There's another case that should be handled. PS1='`xxx(`' causes the\r\n> shell to exit because the old-style backquote leaves an additional file\r\n> on the stack.\r\n\r\nRon's change has been folded into this patch.\r\n\r\nReported-by: Simon Ser \r\nReported-by: Ron Yorston \r\nSigned-off-by: Herbert Xu \r\n\r\n* parser: Fix alias expansion after heredoc or newlines\r\n\r\nThis script should print OK:\r\n\r\n\talias a=\"case x in \" b=x\r\n\ta\r\n\tb) echo BAD;; esac\r\n\r\n\talias BEGIN={ END=}\r\n\tBEGIN\r\n\t\tcat <<- EOF > /dev/null\r\n\t\t\t$(:)\r\n\t\tEOF\r\n\tEND\r\n\r\n\t: <<- EOF &&\r\n\t\t$(:)\r\n\tEOF\r\n\tBEGIN\r\n\t\techo OK\r\n\tEND\r\n\r\nHowever, because the value of checkkwd is either zeroed when it\r\nshouldn't, or isn't zeroed when it should, dash currently gets\r\nit wrong in every case.\r\n\r\nThis patch fixes it by saving checkkwd and zeroing it where needed.\r\n\r\nSuggested-by: Harald van Dijk \r\nReported-by: Harald van Dijk \r\nReported-by: Martijn Dekker \r\nSigned-off-by: Herbert Xu \r\n\r\n* expand: Remove unused expandmeta() flag parameter\r\n\r\nSigned-off-by: Denys Vlasenko \r\nSigned-off-by: Herbert Xu \r\n\r\n* shell: mktokens relative TMPDIR\r\n\r\nThe mktokens script fails when /tmp isn't writable (e.g., when building\r\nin a sandbox with a different TMPDIR). Replace absolute references to\r\n/tmp to relative references to TMPDIR. If TMPDIR is unset or null,\r\ndefault to /tmp.\r\n\r\nThe mkbuiltins script was already hardened to work relative to TMPDIR,\r\nalso defaulting to /tmp.\r\n\r\nv2 ensures that TMPDIR is quoted.\r\nv3 adds an extra quotation that prevents extra pathname expansions.\r\n\r\nSigned-off-by: Michael Greenberg \r\nSigned-off-by: Herbert Xu \r\n\r\n* input: Fix compiling against libedit with -fno-common\r\n\r\nWith -fno-common, which will be enabled by default in GCC 10, we see\r\nthis error:\r\n\r\nld: input.o:(.bss+0x0): multiple definition of `el';\r\nhistedit.o:(.bss+0x8): first defined here\r\n\r\nTo fix this, simply remove the definition as it is not needed.\r\n\r\nSigned-off-by: Jeroen Roovers \r\nSigned-off-by: Mike Gilbert \r\nSigned-off-by: Herbert Xu \r\n\r\n* shell: Always use explicit large file API\r\n\r\nThere are some remaining stat/readdir calls in dash that may lead\r\nto spurious EOVERFLOW errors on 32-bit platforms. This patch changes\r\nthem (as well as open(2)) to use the explicit large file API.\r\n\r\nReported-by: Tatsuki Sugiura \r\nSigned-off-by: Herbert Xu \r\n\r\n* parser: Save and restore heredoclist in expandstr\r\n\r\nOn Sun, May 17, 2020 at 01:19:28PM +0100, Harald van Dijk wrote:\r\n>\r\n> This still does not restore the state completely. It does not clean up any\r\n> pending heredocs. I see:\r\n>\r\n> $ PS1='$(< src/dash: 1: Syntax error: Unterminated quoted string\r\n> $(< >\r\n>\r\n> That is, after entering the ':' command, the shell is still trying to read\r\n> the heredoc from the prompt.\r\n\r\nThis patch saves and restores the heredoclist in expandstr.\r\n\r\nIt also removes a bunch of unnecessary volatiles as those variables\r\nare only referenced in case of a longjmp other than one started by\r\na signal like SIGINT.\r\n\r\nReported-by: Harald van Dijk \r\nSigned-off-by: Herbert Xu \r\n\r\n* shell: Fix typos\r\n\r\nSigned-off-by: Martin Michlmayr \r\nSigned-off-by: Herbert Xu \r\n\r\n* parser: Fix double-backslash nl in old-style command sub\r\n\r\nWhen handling backslashes within an old-style command substitution,\r\nwe should not call pgetc_eatbnl because that would treat the next\r\nbackslash character as another escape character if it was then\r\nfollowed by a new-line.\r\n\r\nThis patch fixes it by calling pgetc.\r\n\r\nReported-by: Matt Whitlock \r\nFixes: 6bbc71d84bea (\"parser: use pgetc_eatbnl() in more places\")\r\nSigned-off-by: Herbert Xu \r\n\r\n* Release 0.5.11.\r\n\r\n* parser: Get rid of PEOA\r\n\r\nPEOA is a special character used to mark an alias as being finished\r\nso that we don't enter an infinite loop with nested aliases. It\r\ncomplicates the parser because we have to ensure that it is skipped\r\nwhere necessary and not copied to the resulting token text.\r\n\r\nThis patch removes it and instead delays the marking of aliases\r\nuntil the second pgetc. This has the same effect as the current\r\nPEOA code while keeping the complexities within the input code.\r\n\r\nSigned-off-by: Herbert Xu \r\n\r\n* eval: Prevent recursive PS4 expansion\r\n\r\nYaroslav Halchenko wrote:\r\n>\r\n> I like to (ab)use PS4 and set -x for tracing execution of scripts.\r\n> Reporting time and PID is very useful in this context.\r\n>\r\n> I am not 100% certain if bash's behavior (of actually running the command\r\n> embedded within PS4 string, probably eval'ing it) is actually POSIX\r\n> compliant, posh seems to not do that; but I think it is definitely not\r\n> desired for dash to just stall:\r\n>\r\n> - the script:\r\n>\r\n> #!/bin/sh\r\n> set -x\r\n> export PS4='+ $(date +%T.%N) [$$] '\r\n>\r\n> echo \"lets go\"\r\n> sleep 1\r\n> echo \"done $var\"\r\n>\r\n> - bash:\r\n>\r\n> /tmp > bash --posix test.sh\r\n> +export 'PS4=+ $(date +%T.%N) [$$] '\r\n> +PS4='+ $(date +%T.%N) [$$] '\r\n> + 09:15:48.982296333 [2764323] echo 'lets go'\r\n> lets go\r\n> + 09:15:48.987829613 [2764323] sleep 1\r\n> + 09:15:49.994485037 [2764323] echo 'done '\r\n> done\r\n>\r\n>\r\n> - posh:\r\n> exit:130 /tmp > posh test.sh\r\n> +export PS4=+ $(date +%T.%N) [$$]\r\n> + $(date +%T.%N) [$$] echo lets go\r\n> lets go\r\n> + $(date +%T.%N) [$$] sleep 1\r\n> + $(date +%T.%N) [$$] echo done\r\n> done\r\n>\r\n> - dash: (stalls it set -x)\r\n>\r\n> /tmp > dash test.sh\r\n> +export PS4=+ $(date +%T.%N) [$$]\r\n> ^C^C\r\n\r\nThis patch fixes the infinite loop caused by repeated expansions\r\nof PS4.\r\n\r\nReported-by: Yaroslav Halchenko \r\nSigned-off-by: Herbert Xu \r\n\r\n* redir: Retry open64 on EINTR\r\n\r\nIt is possible for open64 to block on named pipes, and therefore\r\nit can be interrupted by signals and return EINTR. We should only\r\nlet it fail with EINTR if real signals are pending (i.e., it should\r\nnot fail on SIGCHLD if SIGCHLD has not been trapped).\r\n\r\nThis patch adds a new helper sh_open to retry the open64 call if\r\nnecessary. It also calls sh_error when appropriate.\r\n\r\nFixes: 3800d4934391 (\"[JOBS] Fix dowait signal race\")\r\nReported-by: Samuel Thibault \r\nSigned-off-by: Herbert Xu \r\n\r\n* shell: Enable fnmatch/glob by default\r\n\r\nAs fnmatch(3) and glob(3) from glibc are now working consistently,\r\nthis patch enables them by default.\r\n\r\nSigned-off-by: Herbert Xu \r\n\r\n* expand: Make glob(3) interruptible by SIGINT\r\n\r\nIf glob(3) is used then it can't be interrupted by SIGINT. This\r\nis bad when an expansion causes a large number of entries to be\r\ngenerated. This patch improves things by adding an int_pending\r\ncheck to gl_opendir call. Note that this is still not perfect,\r\ne.g., the sort would still be uninterruptible.\r\n\r\nSigned-off-by: Herbert Xu \r\n\r\n* error: Remove USE_NORETURN ifdef\r\n\r\nThe USE_NORETURN was added because gcc was buggy almost 20 years\r\nago. This is no longer needed and this patch removes it.\r\n\r\nSigned-off-by: Herbert Xu \r\n\r\n* jobs: Fix waitcmd busy loop\r\n\r\nWe need to clear gotsigchld in waitproc because it is used as\r\na loop conditional for the waitcmd case. Without it waitcmd\r\nmay busy loop after a SIGCHLD.\r\n\r\nThis patch also changes gotsigchld into a volatile sig_atomic_t\r\nto prevent compilers from optimising its accesses away.\r\n\r\nFixes: 6c691b3e5099 (\"jobs: Only clear gotsigchld when waiting...\")\r\nSigned-off-by: Herbert Xu \r\n\r\n* eval: Check nflag in evaltree instead of cmdloop\r\n\r\nThis patch moves the nflag check from cmdloop into evaltree. This\r\nis so that nflag will be in force even if we enter the shell via a\r\npath other than cmdloop, e.g., through sh -c.\r\n\r\nReported-by: Joey Hess \r\nSigned-off-by: Herbert Xu \r\n\r\n* man: fix formatting\r\n\r\nFix formatting according to the output of \"mandoc -Tlint\".\r\n\r\nOverview:\r\n\r\n Start each sentence on a new line.\r\n\r\n Protect a punctuation mark in a macro call with '\\&'.\r\n\r\n Trim trailing space.\r\n\r\n Add a missing comma in a row of words.\r\n\r\n Use an en-dash instead of '--' if there is space around it.\r\n An em-dash is used without space around it.\r\n\r\n Comment out \".Pp\" macros that do nothing.\r\n\r\n Split long sentences after a punctuation mark.\r\n\r\n Remove a \"-width ...\" for a \".Bl -item\" macro, as it has no influence\r\n\r\nDetails:\r\n\r\nmandoc: ./src/bltin/echo.1:69:38: WARNING: new sentence, new line\r\nmandoc: ./src/bltin/echo.1:75:35: WARNING: new sentence, new line\r\nmandoc: ./src/bltin/printf.1:205:12: WARNING: skipping empty macro: No\r\nmandoc: ./src/bltin/printf.1:284:28: STYLE: whitespace at end of input line\r\nmandoc: ./src/bltin/printf.1:288:20: STYLE: whitespace at end of input line\r\nmandoc: ./src/bltin/printf.1:293:28: STYLE: whitespace at end of input line\r\nmandoc: ./src/bltin/printf.1:353:31: WARNING: new sentence, new line\r\nmandoc: ./src/bltin/printf.1:74:2: STYLE: useless macro: Tn\r\nmandoc: ./src/bltin/printf.1:111:2: STYLE: useless macro: Tn\r\nmandoc: ./src/bltin/printf.1:116:2: STYLE: useless macro: Tn\r\nmandoc: ./src/bltin/printf.1:279:2: STYLE: useless macro: Tn\r\nmandoc: ./src/bltin/printf.1:334:2: WARNING: unusual Xr punctuation: none before vis(3)\r\nmandoc: ./src/bltin/printf.1:334:2: WARNING: unusual Xr order: vis(3) after printf(9)\r\nmandoc: ./src/bltin/printf.1:348:2: STYLE: useless macro: Tn\r\nmandoc: ./src/bltin/printf.1:333:6: STYLE: referenced manual not found: Xr printf 9\r\nmandoc: ./src/bltin/printf.1:334:6: STYLE: referenced manual not found: Xr vis 3\r\nmandoc: ./src/bltin/test.1:46:16: WARNING: skipping empty macro: Cm\r\nmandoc: ./src/bltin/test.1:105:5: STYLE: useless macro: Tn\r\nmandoc: ./src/dash.1:1180:58: WARNING: new sentence, new line\r\nmandoc: ./src/dash.1:1186:13: STYLE: whitespace at end of input line\r\nmandoc: ./src/dash.1:1194:38: WARNING: new sentence, new line\r\nmandoc: ./src/dash.1:1200:35: WARNING: new sentence, new line\r\nmandoc: ./src/dash.1:1474:71: WARNING: new sentence, new line\r\nmandoc: ./src/dash.1:1783:62: WARNING: new sentence, new line\r\nmandoc: ./src/dash.1:2061:22: WARNING: new sentence, new line\r\nmandoc: ./src/dash.1:2311:54: WARNING: new sentence, new line\r\nmandoc: ./src/dash.1:2315:63: WARNING: new sentence, new line\r\nmandoc: ./src/dash.1:37:2: WARNING: prologue macros out of order: Dt after Os\r\nmandoc: ./src/dash.1:87:2: STYLE: useless macro: Tn\r\nmandoc: ./src/dash.1:94:2: STYLE: useless macro: Tn\r\nmandoc: ./src/dash.1:343:2: STYLE: useless macro: Tn\r\nmandoc: ./src/dash.1:442:17: STYLE: verbatim \"--\", maybe consider using \\(em\r\nmandoc: ./src/dash.1:466:2: STYLE: useless macro: Tn\r\nmandoc: ./src/dash.1:581:34: STYLE: verbatim \"--\", maybe consider using \\(em\r\nmandoc: ./src/dash.1:583:25: STYLE: verbatim \"--\", maybe consider using \\(em\r\nmandoc: ./src/dash.1:585:43: STYLE: verbatim \"--\", maybe consider using \\(em\r\nmandoc: ./src/dash.1:595:11: STYLE: verbatim \"--\", maybe consider using \\(em\r\nmandoc: ./src/dash.1:618:29: STYLE: verbatim \"--\", maybe consider using \\(em\r\nmandoc: ./src/dash.1:697:2: WARNING: skipping paragraph macro: Pp before Bd\r\nmandoc: ./src/dash.1:1344:2: STYLE: useless macro: Tn\r\nmandoc: ./src/dash.1:1420:2: WARNING: skipping paragraph macro: Pp before Bd\r\nmandoc: ./src/dash.1:1434:2: WARNING: skipping paragraph macro: Pp before Bd\r\nmandoc: ./src/dash.1:1556:2: STYLE: useless macro: Tn\r\nmandoc: ./src/dash.1:1587:2: STYLE: useless macro: Tn\r\nmandoc: ./src/dash.1:1746:2: STYLE: useless macro: Tn\r\nmandoc: ./src/dash.1:1875:5: STYLE: useless macro: Tn\r\nmandoc: ./src/dash.1:1525:2: WARNING: skipping paragraph macro: Pp before It\r\nmandoc: ./src/dash.1:2182:2: WARNING: skipping paragraph macro: Pp before It\r\nmandoc: ./src/dash.1:2247:2: WARNING: sections out of conventional order: Sh ENVIRONMENT\r\nmandoc: ./src/dash.1:2323:11: WARNING: skipping -width argument: Bl -item\r\nmandoc: ./src/dash.1:2347:31: STYLE: consider using OS macro: Nx\r\nmandoc: ./src/dash.1:92:6: STYLE: referenced manual not found: Xr ksh 1 (2 times)\r\nmandoc: ./src/dash.1:253:6: STYLE: referenced manual not found: Xr emacs 1\r\nmandoc: ./src/dash.1:2253:9: STYLE: referenced manual not found: Xr passwd 4\r\nmandoc: ./src/dash.1:2330:6: STYLE: referenced manual not found: Xr csh 1\r\n\r\nSigned-off-by: Bjarni Ingi Gislason \r\nSigned-off-by: Herbert Xu \r\n\r\n* shell: Group readdir64/dirent64 with open64\r\n\r\nThe test for open64 is separate from stat64 for macOS. However,\r\nthe newly introduced tests for readdir64/dirent64 should be grouped\r\nwith open64 instead of stat64 as otherwise they cause similar build\r\nfailures.\r\n\r\nReported-by: Martijn Dekker \r\nSigned-off-by: Herbert Xu \r\n\r\n* shell: Disable glob again as it strips traing slashes\r\n\r\nOn Mon, Nov 16, 2020 at 01:47:48PM +1100, Herbert Xu wrote:\r\n> René Scharfe wrote:\r\n> >\r\n> > on Debian testing dash eats trailing slashes of parameters that happen\r\n> > to be regular files when expanding \"$@\". Example:\r\n> >\r\n> > $ rm -f foo bar\r\n> > $ touch foo\r\n> > $ dash -c 'echo \"$0\" \"$@\"' baz foo/ bar/ ./\r\n> > baz foo bar/ ./\r\n>\r\n> In fact you just have to do\r\n>\r\n> \tdash -c 'echo bar\\/'\r\n>\r\n> This is a bug in glob(3). It's stripping the slash.\r\n>\r\n> I guess we'll just have to disable glob again.\r\n\r\nThis patch disables glob(3) by default.\r\n\r\nReported-by: René Scharfe \r\nSigned-off-by: Herbert Xu \r\n\r\n* jobs: Only block in waitcmd on first run\r\n\r\nThis patch ensures that waitcmd never blocks unless there are\r\noutstanding jobs. This could otherwise trigger a hang if children\r\nwere created prior to the shell coming into existence, or if\r\nthere are backgrounded children of other kinds (e.g., a here-\r\ndocument).\r\n\r\nFixes: 6c691b3e5099 (\"jobs: Only clear gotsigchld when waiting...\")\r\nReported-by: Michael Biebl \r\nSigned-off-by: Herbert Xu \r\n\r\n* shell: Fail if building --with-libedit and can't find libedit\r\n\r\nPreviously, configure --with-libedit would only fail in the case where\r\nlibedit is available but its header file histedit.h is not.\r\n\r\nFixes: 13537aaa484b (\"[BUILD] Added --with-libedit option to...\")\r\nSigned-off-by: Herbert Xu \r\n\r\n* input: Clear unget on RESET\r\n\r\nOn Sat, Dec 19, 2020 at 02:23:44PM +0100, Denys Vlasenko wrote:\r\n> Current git:\r\n>\r\n> $ ;l\r\n> dash: 1: Syntax error: \";\" unexpected\r\n> $ s\r\n> COPYING ChangeLog.O Makefile.am aclocal.m4 autom4te.cache\r\n> config.h config.log configure dash\r\n> dollar_altvalue1.tests missing stamp-h1\r\n> ChangeLog Makefile Makefile.in autogen.sh compile\r\n> config.h.in config.status configure.ac depcomp install-sh\r\n> src trace\r\n\r\nThis patch fixes it by clearing ungetc on RESET.\r\n\r\nFixes: 17db43b58415 (\"input: Allow two consecutive calls to pungetc\")\r\nReported-by: Denys Vlasenko \r\nSigned-off-by: Herbert Xu \r\n\r\n* jobs: Block signals during tcsetpgrp\r\n\r\nHarald van Dijk wrote:\r\n> On 19/12/2020 22:21, Steffen Nurpmeso wrote:\r\n>> Steffen Nurpmeso wrote in\r\n>> <20201219172838.1B-WB%steffen@sdaoden.eu>:\r\n>> |Long story short, after falsely accusing BSD make of not working\r\n>>\r\n>> After dinner i shortened it a bit more, and attach it again, ok?\r\n>> It is terrible, but now less redundant than before.\r\n>> Sorry for being so terse, that problem crosses my head for about\r\n>> a week, and i was totally mislead and if you bang your head\r\n>> against the wall so many hours bugs or misbehaviours in a handful\r\n>> of other programs is not the expected outcome.\r\n>\r\n> I think a minimal test case is simply\r\n>\r\n> all:\r\n> $(SHELL) -c 'trap \"echo TTOU\" TTOU; set -m; echo all good'\r\n>\r\n> unless I accidentally oversimplified.\r\n>\r\n> The SIGTTOU is caused by setjobctl's xtcsetpgrp(fd, pgrp) call to make\r\n> its newly started process group the foreground process group when job\r\n> control is enabled, where xtcsetpgrp is a wrapper for tcsetpgrp. (That's\r\n> in dash, the other variants may have some small differences.) tcsetpgrp\r\n> has this little bit in its specification:\r\n>\r\n> Attempts to use tcsetpgrp() from a process which is a member of\r\n> a background process group on a fildes associated with its con‐\r\n> trolling terminal shall cause the process group to be sent a\r\n> SIGTTOU signal. If the calling thread is blocking SIGTTOU sig‐\r\n> nals or the process is ignoring SIGTTOU signals, the process\r\n> shall be allowed to perform the operation, and no signal is\r\n> sent.\r\n>\r\n> Ordinarily, when job control is enabled, SIGTTOU is ignored. However,\r\n> when a trap action is specified for SIGTTOU, the signal is not ignored,\r\n> and there is no blocking in place either, so the tcsetpgrp() call is not\r\n> allowed.\r\n>\r\n> The lowest impact change to make here, the one that otherwise preserves\r\n> the existing shell behaviour, is to block signals before calling\r\n> tcsetpgrp and unblocking them afterwards. This ensures SIGTTOU does not\r\n> get raised here, but also ensures that if SIGTTOU is sent to the shell\r\n> for another reason, there is no window where it gets silently ignored.\r\n>\r\n> Another way to fix this is by not trying to make the shell start a new\r\n> process group, or at least not make it the foreground process group.\r\n> Most other shells appear to not try to do this.\r\n\r\nThis patch implements the blocking of SIGTTOU (and everything else)\r\nwhile we call tcsetpgrp.\r\n\r\nReported-by: Steffen Nurpmeso \r\nSigned-off-by: Herbert Xu \r\n\r\n* jobs: Always reset SIGINT/SIGQUIT handlers\r\n\r\nOn Fri, Jan 08, 2021 at 08:55:41PM +0000, Harald van Dijk wrote:\r\n> On 18/05/2018 19:39, Herbert Xu wrote:\r\n> > This patch adds basic vfork support for the case of a simple command.\r\n> > ... @@ -879,17 +892,30 @@ forkchild(struct job *jp, union node *n, int\r\n> > mode)\r\n> > \t\t}\r\n> > \t}\r\n> > \tif (!oldlvl && iflag) {\r\n> > -\t\tsetsignal(SIGINT);\r\n> > -\t\tsetsignal(SIGQUIT);\r\n> > +\t\tif (mode != FORK_BG) {\r\n> > +\t\t\tsetsignal(SIGINT);\r\n> > +\t\t\tsetsignal(SIGQUIT);\r\n> > +\t\t}\r\n> > \t\tsetsignal(SIGTERM);\r\n> > \t}\r\n> > +\r\n> > +\tif (lvforked)\r\n> > +\t\treturn;\r\n> > +\r\n> > \tfor (jp = curjob; jp; jp = jp->prev_job)\r\n> > \t\tfreejob(jp);\r\n> > }\r\n>\r\n> This leaves SIGQUIT ignored in background jobs in interactive shells.\r\n>\r\n> ENV= dash -ic 'dash -c \"kill -QUIT \\$\\$; echo huh\" & wait'\r\n>\r\n> As of dash 0.5.11, this prints \"huh\". Before, the subprocess process killed\r\n> itself before it could print anything. Other shells do not leave SIGQUIT\r\n> ignored.\r\n>\r\n> (In a few other shells, this also prints \"huh\", but in those other shells,\r\n> that is because the inner shell chooses to ignore SIGQUIT, not because the\r\n> outer shell leaves it ignored.)\r\n\r\nThanks for catching this. I have no idea how that got in there\r\nand it makes no sense whatsoever. This patch removes the if\r\nconditional.\r\n\r\nFixes: e94a964e7dd0 (\"eval: Add vfork support\")\r\nReported-by: Harald van Dijk \r\nSigned-off-by: Herbert Xu \r\n\r\n* eval: Do not cache value of eflag in evaltree\r\n\r\nPatrick Brünn wrote:\r\n>\r\n> Since we are migrating to Debian bullseye, we discovered a new behavior\r\n> with our scripts, which look like this:\r\n>>#!/bin/sh\r\n>>cleanup() {\r\n>> set +e^M\r\n>> rmdir \"\"\r\n>>}\r\n>>set -eu\r\n>>trap 'cleanup' EXIT INT TERM\r\n>>echo 'Hello world!'\r\n>\r\n> With old dash v0.5.10.2 this script would return 0 as we expected it.\r\n> But since commit 62cf6955f8abe875752d7163f6f3adbc7e49ebae it returns\r\n> the last exit code of our cleanup function.\r\n> Reverting that commit gives a merge conflict, but it seems to fix _our_\r\n> problem. As that topic appears too complex to us I want to ask the\r\n> experts here:\r\n>\r\n> Is this change in behavior intended, by dash?\r\n>\r\n> Our workaround at the moment would be:\r\n>>trap 'cleanup || true' EXIT INT TERM\r\n\r\nThanks for the report. This is actually a fairly old bug with\r\nset -e that's just been exposed by the exit status change. What's\r\nreally happening is that cleanup itself is triggering a set -e\r\nexit incorrectly because evaltree cached the value of eflag prior\r\nto the function call.\r\n\r\nThis patch should fix the problem.\r\n\r\nReported-by: Patrick Brünn \r\nSigned-off-by: Herbert Xu \r\nTested-by: Patrick Brünn \r\nSigned-off-by: Herbert Xu \r\n\r\n* shell: Call CHECK_DECL on stat64\r\n\r\nOn macOS it is possible to find stat64 at link-time but not at\r\ncompile-time. To make the build process more robust we should\r\ncheck for the header file as well as the library.\r\n\r\nReported-by: Saagar Jha \r\nSigned-off-by: Herbert Xu \r\n\r\n* parser: Fix VSLENGTH parsing with trailing garbage\r\n\r\nOn Sat, Jun 19, 2021 at 02:44:46PM +0200, Denys Vlasenko wrote:\r\n>\r\n> CTLVAR and CTLBACKQ are not properly handled if encountered\r\n> inside {$#...}. Testcase:\r\n>\r\n> dash -c \"`printf 'echo ${#1\\x82}'`\" 00 111 222\r\n>\r\n> It should execute \"echo ${#1 }\" and thus print \"3\"\r\n> (the length of $1, which is \"111\").\r\n>\r\n> Instead, it segfaults.\r\n>\r\n> (Ideally, it should fail since \"1 \" is not a valid\r\n> variable name, but currently dash accepts e.g. \"${#1abc}\"\r\n> as if it is \"${#1}bc\". A separate, less serious bug...).\r\n\r\nIn fact these two bugs are one and the same. This patch fixes\r\nboth by detecting the invalid substitution and not emitting it\r\ninto the node tree.\r\n\r\nIncidentally this reveals a bug in how we parse ${#10} that got\r\nintroduced recently, which is also fixed here.\r\n\r\nReported-by: Denys Vlasenko \r\nFixes: 7710a926b321 (\"parser: Only accept single-digit parameter...\")\r\nSigned-off-by: Herbert Xu \r\n\r\n* input: Remove special case for unget EOF\r\n\r\nCommit 17db43b5841504b694203952fb0e82246c06a97f (input: Allow two\r\nconsecutive calls to pungetc) ensures that EOF is handled like any\r\nother character with respect to unget. As a result it's possible\r\nto remove the special case for unget of EOF in preadbuffer.\r\n\r\nSigned-off-by: Ron Yorston \r\nSigned-off-by: Herbert Xu \r\n\r\n* expand: Always quote caret when using fnmatch\r\n\r\nThis patch forces ^ to be a literal when we use fnmatch.\r\n\r\nIn order to allow for the extra space to quote the caret, the\r\nfunction _rmescapes will allocate up to twice the memory if the\r\nflag RMESCAPE_GLOB is set.\r\n\r\nFixes: 7638476c18f2 (\"shell: Enable fnmatch/glob by default\")\r\nReported-by: Christoph Anton Mitterer \r\nSuggested-by: Harald van Dijk \r\nSigned-off-by: Herbert Xu \r\n\r\n* expand: Add ifsfree to expand to fix a logic error that causes a buffer over-read\r\n\r\nOn Mon, Jun 20, 2022 at 02:27:10PM -0400, Alex Gorinson wrote:\r\n> Due to a logic error in the ifsbreakup function in expand.c if a\r\n> heredoc and normal command is run one after the other by means of a\r\n> semi-colon, when the second command drops into ifsbreakup the command\r\n> will be evaluated with the ifslastp/ifsfirst struct that was set when\r\n> the here doc was evaluated. This results in a buffer over-read that\r\n> can leak the program's heap, stack, and arena addresses which can be\r\n> used to beat ASLR.\r\n>\r\n> Steps to Reproduce:\r\n> First bug:\r\n> cmd args: ~/exampleDir/example> dash\r\n> $ M='AAAAAAAAAAAAAAAAA' \r\n> $ q00(){\r\n> $ <<000;echo\r\n> $ ${D?$M$M$M$M$M$M} \r\n> $ 000\r\n> $ }\r\n> $ q00 should be echo'd out; this works with ash, busybox ash, and dash and\r\n> with all option args.>\r\n>\r\n> Patch:\r\n> Adding the following to expand.c will fix both bugs in one go.\r\n> (Thank you to Harald van Dijk and Michael Greenberg for doing the\r\n> heavy lifting for this patch!)\r\n> ==========================\r\n> --- a/src/expand.c\r\n> +++ b/src/expand.c\r\n> @@ -859,6 +859,7 @@\r\n> if (discard)\r\n> return -1;\r\n>\r\n> +ifsfree();\r\n> sh_error(\"Bad substitution\");\r\n> }\r\n>\r\n> @@ -1739,6 +1740,7 @@\r\n> } else\r\n> msg = umsg;\r\n> }\r\n> +ifsfree();\r\n> sh_error(\"%.*s: %s%s\", end - var - 1, var, msg, tail);\r\n> }\r\n> ==========================\r\n\r\nThanks for the report!\r\n\r\nI think it's better to add the ifsfree() call to the exception\r\nhandling path as other sh_error calls may trigger this too.\r\n\r\nReported-by: Alex Gorinson \r\nSigned-off-by: Herbert Xu \r\n\r\n* eval: Always set exitstatus in evaltree\r\n\r\nThere is no harm in setting exitstatus unconditionally in evaltree.\r\n\r\nSigned-off-by: Herbert Xu \r\n\r\n* eval: Check eflag after redirection error\r\n\r\n>\r\n> This is a POSIX violation, and quite a grave one at that:\r\n> set -e is oft[1] used to guard against precisely this type of error!\r\n>\r\n> The same happens if set -e is executed.\r\n>\r\n> All quotes POSIX.1, Issue 7, TC2:\r\n> sh, OPTIONS:\r\n> > The -a, -b, -C, -e, -f, -m, -n, -o option, -u, -v, and -x options\r\n> > are described as part of the set utility in Special Built-In\r\n> > Utilities.\r\n>\r\n> set, DESCRIPTION, -e:\r\n> > When this option is on, when any command fails (for any of the\r\n> > reasons listed in Consequences of Shell Errors or by returning an\r\n> > exit status greater than zero), the shell immediately shall exit, as\r\n> > if by executing the exit special built-in utility with no arguments,\r\n> > with the following exceptions:\r\n> >\r\n> > 1. The failure of any individual command in a multi-command pipeline\r\n> > shall not cause the shell to exit. Only the failure of the\r\n> > pipeline itself shall be considered.\r\n> > 2. The -e setting shall be ignored when executing the compound list\r\n> > following the while, until, if, or elif reserved word, a pipeline\r\n> > beginning with the ! reserved word, or any command of an AND-OR\r\n> > list other than the last.\r\n> > 3. If the exit status of a compound command other than a subshell\r\n> > command was the result of a failure while -e was being ignored,\r\n> > then -e shall not apply to this command.\r\n>\r\n> XCU, 2.9.4: Shell Command Language, Shell Commands, Compound Commands:\r\n> The while Loop:\r\n> > The format of the while loop is as follows:\r\n> >\r\n> > while compound-list-1\r\n> > do\r\n> > compound-list-2\r\n> > done\r\n> (until is equivalent).\r\n> The if Conditional Construct:\r\n> > The format for the if construct is as follows:\r\n> >\r\n> > if compound-list\r\n> > then\r\n> > compound-list\r\n> > [elif compound-list\r\n> > then\r\n> > compound-list] ...\r\n> > [else\r\n> > compound-list]\r\n> > fi\r\n>\r\n> It follows, therefore, that\r\n> * Exception 1. does not apply as there is no pipeline\r\n> * Exception 2. does not apply, as the redirection does /not/ follow\r\n> \"while\" or \"if\" directly and is /not/ part of the conditional\r\n> compound-list\r\n> * in the \"for\" case, there is no such provision, so this is likely not\r\n> a confusion w.r.t. the conditional compound-lists\r\n> * Exception 3. does not apply as -e was not being ignored while the\r\n> compound commands were being executed (indeed, the compound commands\r\n> do not run at all, as evidenced by the program terminating)\r\n>\r\n> [1]: https://salsa.debian.org/glibc-team/glibc/-/merge_requests/6#note_329899\r\n> ----- End forwarded message -----\r\n\r\nYes we should check the exit status after redirections.\r\n\r\nReported-by: наб \r\nSigned-off-by: Herbert Xu \r\n\r\n* parser: Add VSBIT to ensure subtype is never zero\r\n\r\nHarald van Dijk wrote:\r\n> On 21/11/2022 13:08, Harald van Dijk wrote:\r\n>> On 21/11/2022 02:38, Christoph Anton Mitterer wrote:\r\n>>> reject_filtered_cmd()\r\n>>> {\r\n>>> \treject_and_die \"disallowed command${restrict_path_list:+\r\n>>> (restrict-path: \\\"${restrict_path_list//|/\\\", \\\"}\\\")}\"\r\n>>> }\r\n>>>\r\n>>> reject_filtered_cmd\r\n>>[...]\r\n>> This should either result in the ${...//...} being skipped, or the \"Bad\r\n>> substitution\" error. Currently, what happens instead is it attempts, but\r\n>> fails, to skip the ${...//...}.\r\n>\r\n> The reason it fails is because the word is cut off.\r\n>\r\n> Variable substitutions are encoded as a CTLVAR special character,\r\n> followed by a byte indicating the type of substitution, followed by the\r\n> rest of the substitution data. The type of substitution is the VSNORMAL,\r\n> VSMINUS, etc. seen in parser.h. An invalid substitution is encoded as a\r\n> value of 0.\r\n>\r\n> When we define a function, we clone the function body in order to\r\n> preserve it. Cloning the function body is done by cloning each node.\r\n> Cloning a \"word\" node (NARG) involves copying the characters that make\r\n> up the word up to and including the terminating null byte.\r\n>\r\n> These two interact badly. The invalid substitution is seen as\r\n> terminating the word, the rest of the word is not copied, but the\r\n> expansion code does not have any way of seeing that anything got cut off\r\n> and happily continues attempting to process the rest of the word.\r\n>\r\n> If dash decides to issue an error in this case, this is not a problem:\r\n> the null byte is guaranteed to be copied, and if processing is\r\n> guaranteed to stop if a null byte is encountered, everything works out.\r\n>\r\n> If dash decides to not issue an error in this case, the encoding of bad\r\n> substitutions needs to change to a non-null byte. It appears that if we\r\n> set the byte to VSNUL, the expansion logic is already able to handle it,\r\n> but I have not tested this extensively.\r\n\r\nThanks for the analysis Harald!\r\n\r\nThis patch does basically what you've described except it uses a new\r\nbit to avoid any confusion with a genuine VSNUL.\r\n\r\nFixes: 3df3edd13389 (\"[PARSER] Report substition errors at...\")\r\nReported-by: Christoph Anton Mitterer \r\nSigned-off-by: Herbert Xu \r\n\r\nCheers,\r\n\r\nSigned-off-by: Herbert Xu \r\n\r\n* eval: Test evalskip before flipping status for NNOT\r\n\r\nOn Tue, Dec 06, 2022 at 10:15:03AM +0000, Harald van Dijk wrote:\r\n>\r\n> There is a long-standing bug that may or may not be harder to fix if this\r\n> patch goes in, depending on how you want to fix it. Here's a script that\r\n> already fails on current dash.\r\n>\r\n> f() {\r\n> if ! return 0\r\n> then :\r\n> fi\r\n> }\r\n> f\r\n>\r\n> This should return 0, and does return 0 in bash and ksh (and almost all\r\n> shells), but returns 1 in dash.\r\n>\r\n> There are a few possible ways of fixing it. Some of them rely on continuing\r\n> to conditionally set exitstatus.\r\n\r\nThis can be fixed simply by testing evalskip prior to flipping the\r\nstatus.\r\n\r\nReported-by: Harald van Dijk \r\nSigned-off-by: Herbert Xu \r\n\r\n* Release 0.5.12.\r\n\r\n---------\r\n\r\nSigned-off-by: Herbert Xu \r\nSigned-off-by: Nikolai Merinov \r\nSigned-off-by: Denys Vlasenko \r\nSigned-off-by: Michael Greenberg \r\nSigned-off-by: Jeroen Roovers \r\nSigned-off-by: Mike Gilbert \r\nSigned-off-by: Martin Michlmayr \r\nSigned-off-by: Bjarni Ingi Gislason \r\nSigned-off-by: Ron Yorston \r\nCo-authored-by: Herbert Xu \r\nCo-authored-by: Nikolai Merinov \r\nCo-authored-by: Fangrui Song \r\nCo-authored-by: Denys Vlasenko \r\nCo-authored-by: Jeroen Roovers \r\nCo-authored-by: Martin Michlmayr \r\nCo-authored-by: Bjarni Ingi Gislason \r\nCo-authored-by: C. McEnroe \r\nCo-authored-by: Ron Yorston ","shortMessageHtmlLink":"Merge v0.5.12 from upstream (#27)"}},{"before":"b31a032f16b2b12ee3919c65209704e46d0bb269","after":"d6f2e0dc5e05199e852bdd03db1d086547ddc70f","ref":"refs/heads/master","pushedAt":"2023-11-28T19:46:08.000Z","pushType":"push","commitsCount":1,"pusher":{"login":"mgree","name":"Michael Greenberg","path":"/mgree","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/505088?s=80&v=4"},"commit":{"message":"update checkout","shortMessageHtmlLink":"update checkout"}},{"before":null,"after":"5b15fe94b7d560ec80d13ce1b2049e283646453c","ref":"refs/heads/merge-v0.5.12","pushedAt":"2023-11-15T21:48:30.000Z","pushType":"branch_creation","commitsCount":0,"pusher":{"login":"mgree","name":"Michael Greenberg","path":"/mgree","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/505088?s=80&v=4"},"commit":{"message":"merge upstream 'v0.5.12'","shortMessageHtmlLink":"merge upstream 'v0.5.12'"}}],"hasNextPage":false,"hasPreviousPage":false,"activityType":"all","actor":null,"timePeriod":"all","sort":"DESC","perPage":30,"cursor":"djE6ks8AAAAD8ZTEiwA","startCursor":null,"endCursor":null}},"title":"Activity · binpash/libdash"}