User Details
- User Since
- May 14 2014, 7:55 PM (552 w, 5 d)
Jun 7 2024
Given that set -e is a controversial issue (see the disagreement here and in the "Conclusions" section of https://mywiki.wooledge.org/BashFAQ/105 ), I don't think the man page should recommend anything about it, although it should mention some pitfalls in a neutral manner.
May 4 2024
The immediately preceding sentence about shell functions is an example of unexpected behaviour of set -e. The part "all commands of the function are considered to be tested as well" may result in code unexpectedly executing in the function and the function returning a different return status.
Dec 1 2023
Nov 20 2023
Nov 17 2023
Nov 14 2023
This looks like a reasonable quick fix, but I think it's unfortunate the /root directory permissions are specified both in bsd.dirs.mk variables and in the BSD.root.dist mtree file. It looks like the bsd.dirs.mk variables are required because of pkgbase.
Jul 4 2023
Jun 8 2023
Jun 4 2023
I agree with the analysis, but the variables should still be defined inside main (with static) so they cannot be used outside. Some of the other functions in this file have their own smark locals that should not be mixed up with main's.
Jun 3 2023
To me, it looks like that situation can't actually happen. If there is an error or SIGINT during early initialization, state will still be 0 and the if (setjmp(main_handler.loc)) block will immediately call exitshell(exitstatus) without touching smark. If I'm wrong, please provide a reproduction scenario.
Apr 28 2023
Apr 27 2023
This doesn't follow the Don't Repeat Yourself principle, but currently I don't have a better idea how to express this code.
Jan 5 2023
Jan 1 2023
Code is OK like this.
Dec 22 2022
Dec 18 2022
Dec 14 2022
Adding support for escape sequences might make it important to increase PROMPTLEN.
Dec 11 2022
Dec 7 2022
How do other shells with a similar option handle this? For example, zsh has a TRAPS_ASYNC option, but does not document how to access the interrupted job in the trap action.
Oct 23 2022
In hindsight, this is how it should have been in the first place, since it's the same thing Linux distributions do. They (used to?) place *.csh files too for sourcing from /etc/csh.login.
Sep 27 2022
Since a similar effect can be obtained by having the shell ignore the signal via trap '' TTOU, I'm not sure it's a good idea to add an option for this.
Fine with me to add this to make some compiler/linter happy, even though non-static array bounds in parameters don't really do anything.
Sep 25 2022
Sep 9 2022
Oh, the unset obviously defeats the purpose. Defending against someone copying /etc/profile to /usr/local/etc/profile without leaving stray variables in the user's environment is a little harder.
Aug 19 2022
Aug 4 2022
Jul 23 2022
This should have testcases.
Jul 22 2022
Thanks, I have also encountered this issue.
Jul 19 2022
Jul 18 2022
A little unfortunate to have these strange backslash sequences spread out further, but it's nothing that bash doesn't do.
Jun 12 2022
May 26 2022
May 21 2022
Apr 20 2022
POSIX indeed leaves this behavior unspecified, but Linux chooses the same as we do. Might want to add something like
POSIX leaves the behavior of .Fn sigtimedwait with a .Dv NULL .Fa timeout pointer unspecified.
to the STANDARDS section.
Apr 10 2022
Apr 3 2022
Apr 2 2022
Mar 27 2022
Mar 14 2022
Mar 13 2022
Mar 9 2022
Mar 8 2022
Feb 11 2022
Jan 26 2022
Jan 23 2022
Jan 14 2022
Oct 27 2021
Oct 26 2021
Oct 24 2021
Oct 5 2021
Oct 1 2021
Sep 22 2021
I agree that OPTIND=1 is needed, but I have another reason for it. POSIX requires that a script set OPTIND=1 between using different sets of parameters with getopts; otherwise, the results are unspecified.
OK. Thanks for the reminder.
Sep 17 2021
Sep 8 2021
This is more consistent, and probably more useful (while read loops tend not to treat EOF and read errors differently).
Aug 28 2021
OK, but perhaps this fix should be in libedit instead. The same issue can be seen in other libedit clients such as ftp(1).
Jul 25 2021
Jul 10 2021
This functionality clearly fills a gap, but the provided interface is too low level for applications to call. The code in lib/libc/gen/posix_spawn.c uses various non-standard facilities to handle things like signals correctly. Depending on how this is planned to be used, additional libc code may be useful, but it need not be part of this review.
Jun 20 2021
Jun 11 2021
Jun 8 2021
Jun 2 2021
The -- was added so that source pathnames starting with - would not break. I guess destination pathnames starting with - already did not work before D25551, so that was not a regression. This could be fixed differently by prepending ./ if the name starts with -.
May 30 2021
May 29 2021
Looks reasonable, assuming veriexec itself is reasonable (in many cases, it seems to me that verifying the root filesystem would be a simpler and more reliable approach).
May 18 2021
May 12 2021
The comment is correct. LOG_PID has no effect and the process ID is always included. This change was made along with the move from RFC 3164 to RFC 5424 log messages.
May 6 2021
Some people may get negatively surprised if they first encounter this change in a git update. A post to -current@ and Relnotes: yes are probably a good idea.
May 4 2021
I like it better if EFAULT is reserved as much as possible to the case where a syscall argument points to an invalid memory location for the calling process, which is undefined behaviour according to POSIX and other standards and often behaves poorly (for example, completing an operation but discarding the result). If the address in the target process passed to PT_READ_I is invalid, this is fully defined and may not be fully avoidable (for example if the traced process is running concurrently).
May 2 2021
There should be documentation about this in the man page.
Mar 30 2021
Note that this can still be overridden via $EDITRC, ~/.editrc or a bind command after set -o emacs.
Another nice feature, but I expect that making it good enough to replace bigger shells will take more work. For example, the save-all/load-all approach may be rather slow with the number of history entries I personally like to keep.
Mar 21 2021
Mar 11 2021
Perhaps it makes more sense to implement this as a separate program that performs setsid() and then execvp(). This is a bit like daemon, but not quite, since daemon also forks and makes it hard to track the child process. As noted in the man page, sh tends not to implement many extensions. Extensions like set -o trapsasync and set -o pipefail are different from this one because they are hard to implement outside the shell or in a shell script. Of these, set -o pipefail is particularly simple to implement in the shell.
Jan 30 2021
Jan 19 2021
This was reported before as https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=218598 but I did not know for sure what to do so I left it alone. Since the patch is essentially the same, perhaps we should make this change. The wording of the error message in the patch in the PR seems a bit more formal, so better.