Conversation
The idiom `sed -n 's/.../.../p'` already correctly filters the lines. The same pattern can also be used in the sed expression for curl.
* refactor(function): use tail instead of sed "sed -e 1,2d" is interchangeable with "tail -n +3". This usage of "tail" is already used in many places in the codebase. The current sed expression was introduced as "1d" in commit ea10afb and modified to "1,2d" in commit 4351ae5. * refactor(_comp_compgen_p{ids,gids,names}): use tail instead of sed * refactor(2to3,mcrypt,msynctool,pdftotext): use tail instead of sed "sed -e 1d" used in other places can also be replaced with "tail -n +2".
scop
left a comment
There was a problem hiding this comment.
LGTM, thanks!
I have a nagging feeling that some POSIX features of basic tools cannot be taken for granted e.g. on Solaris, but I've no easy access to such a box any more, and at least the ones I tried work on FreeBSD, so let's do this.
|
Thank you.
|
|
I checked the behavior in Solaris 11.3. It turned out that Solaris I haven't checked the behavior of Solaris 11.4 because I don't have a virtual machine currently, but I found an article (written in Japanese 1) saying that Solaris 11.4 By the way, do we care about the support for Solaris 11.4? Solaris isn't mentioned in #1429 nor in Minimum bash versions - Wiki. Solaris 11.4 support seems to continue until 2037. If we care about it, we may need to continue to support Bash 4.4 until 2037. We probably want to intentionally ignore Solaris 11.4. Footnotes |
|
I think we should care about what we are willing to maintain and can test. Or in other words, what we care about :) As far as I'm personally concerned, that no longer includes any Solaris version as I don't have access to one nor can I test with one these days. I have no problem if others want to support it as long as it doesn't get too badly on the way of keeping things working on other "more supported" platforms. |
The use of "sed 1d" has been replaced with "tail -n +2" in GitHub PR 1567, but it turned out that "tail" in Solaris 11.3 does not support "tail -n +2", i.e., the POSIX option "-n" [1]. This patch tries to fix up the uses of "tail" by introducing a compatibility wrapper for "tail". Solaris 11.3 provides a POSIX-compatible version of tail through /usr/xpg4/bin/tail in a similar way as the POSIX-compatible version of awk at /usr/xpg4/bin/awk. We add a wrapper for "tail" in the same way as we do for "awk". To avoid aliases and shell functions of the same name, the new wrapper also prefixes "command" to call "tail" in normal environment. The branch that had used "sed 1d" for Solaris is also selected in AIX. This lead to a suspicion that AIX tail might also have a compatibility issue [2]. According to the online manuals, the tail command in AIX (at least >= 5.3) seems to support "-n +N" [3-5]. [1] \ scop#1567 (comment) [2] \ scop#1567 (comment) [3] AIX 5.3 (2004-08) \ http://public.dhe.ibm.com/systems/power/docs/aix/53/aixcmds5.pdf [4] AIX 6.1 (2007-11) \ http://public.dhe.ibm.com/systems/power/docs/aix/61/aixcmds5_pdf.pdf [5] AIX 7.3.0 (2021-12) \ https://www.ibm.com/docs/en/aix/7.3.0?topic=t-tail-command
As mentioned in #1572, for now, I think we can support Solaris 11.3 tail with a simple compatibility wrapper. |
No description provided.