Summary: | net-misc/netifrc: `/etc/init.d/net.* stop` has errors when using app-alternatives/awk[mawk] | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | Nick Doyle <njd.dev> |
Component: | Current packages | Assignee: | netifrc Team <netifrc> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | ionen, kfm, sam, toralf |
Priority: | Normal | Keywords: | InVCS, PATCH |
Version: | unspecified | ||
Hardware: | All | ||
OS: | Linux | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- | |
Bug Depends on: | 906089 | ||
Bug Blocks: | |||
Attachments: |
0001-net-l2tp.sh-Rewrite-to-address-issues-of-POSIX-confo.patch
0002-net-l2tp.sh-Re-order-function-declarations-and-use-a.patch |
Description
Nick Doyle
2023-01-08 15:54:04 UTC
Note it's not only about GNU'ism when mawk is involved, app-alternatives/awk has this warning for mawk: # Show the warning on new installs if using mawk, or older installs # if upgrading from < app-alternatives/awk-4[mawk]. if [[ -z ${REPLACING_VERSIONS} || ${SHOW_MAWK_WARNING} -eq 1 || ${HAD_MAWK} -eq 0 ]] && use mawk; then ewarn "mawk (incompletely) implements awk, as it was defined by the now-obsolete" ewarn "POSIX 1003.2 (draft 11.3) specification. It does not fully implement the standard" ewarn "extended regular expression syntax and there are other known issues pertaining to POSIX conformance." fi i.e. does USE=nawk or USE=busybox work fine? Or does only gawk work? USE=busybox reports no errors. USE=nawk has a similar error to mawk: awk: syntax error at source line 1 context is match($0, /^Session ([0-9]+) in tunnel >>> ([0-9]+)$/, <<< awk: bailing out at source line 1 jkroon, if you use l2tp (I think you do), is there any chance you could share the output of `ip l2tp show session` we know what it's supposed to look like? Thank you! (In reply to Sam James from comment #3) > jkroon, if you use l2tp (I think you do), is there any chance you could > share the output of `ip l2tp show session` we know what it's supposed to > look like? Also, "show tunnel", if it's not too much trouble. The script will need to refrain from using the three-arg form of match(), at the very least. Hi, kerberos [10:34:48] ~ # ip l2tp show session RTNETLINK answers: No such file or directory Error talking to the kernel kerberos [10:34:56] ~ # ip l2tp show tunnel RTNETLINK answers: No such file or directory Error talking to the kernel So that's ... interesting to say the least. Perhaps xl2tpd runs all of these from userspace? If someone can provide me a sample config for l2tp from /etc/conf.d/net I can definitely give it a spin for you. This may relate to the errors above: tauri [10:39:51] ~ # gunzip < /proc/config.gz | grep L2TP CONFIG_NETFILTER_XT_MATCH_L2TP=m CONFIG_L2TP=y CONFIG_L2TP_DEBUGFS=y # CONFIG_L2TP_V3 is not set <------ CONFIG_PPPOL2TP=m Sorry for not being much help here. (In reply to Jaco Kroon from comment #5) ing to the kernel > > So that's ... interesting to say the least. Perhaps xl2tpd runs all of > these from userspace? If someone can provide me a sample config for l2tp > from /etc/conf.d/net I can definitely give it a spin for you. Thanks for trying. I think you're right; iproute2 is to be used to manage the L2TPv3 implementation in the kernel. I'll try to set up some tunnels in that way. Created attachment 848493 [details, diff]
0001-net-l2tp.sh-Rewrite-to-address-issues-of-POSIX-confo.patch
Created attachment 848495 [details, diff]
0002-net-l2tp.sh-Re-order-function-declarations-and-use-a.patch
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/proj/netifrc.git/commit/?id=b6c67a56b566b0a178fc8eb7cac761e0f6521356 commit b6c67a56b566b0a178fc8eb7cac761e0f6521356 Author: Kerin Millar <kfm@plushkava.net> AuthorDate: 2023-01-14 23:04:46 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2023-01-15 01:51:26 +0000 net/l2tp.sh: Re-order function declarations and use a consistent brace style This is how I would initially have submitted it, only I wanted for the initial set of changes to be legible as a unified diff. Signed-off-by: Kerin Millar <kfm@plushkava.net> Bug: https://bugs.gentoo.org/890238 Signed-off-by: Sam James <sam@gentoo.org> net/l2tp.sh | 168 +++++++++++++++++++++++++++++------------------------------- 1 file changed, 82 insertions(+), 86 deletions(-) https://gitweb.gentoo.org/proj/netifrc.git/commit/?id=1601d0dbed5d0373f0e19f90f07612bf60c59184 commit 1601d0dbed5d0373f0e19f90f07612bf60c59184 Author: Kerin Millar <kfm@plushkava.net> AuthorDate: 2023-01-14 22:58:41 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2023-01-15 01:51:20 +0000 net/l2tp.sh: Rewrite to address issues of POSIX conformance (and more besides) Ensure that awk(1) is used portably throughout. Eliminate the use of ${parameter^^} expansion syntax, which is a bashism. Delegate netfirc parameter parsing to xargs(1) and awk(1). The potential for code injection is thus eliminated, to the extent that is currently possible in netifrc. It also eliminates potential issues pertaining to word splitting and unintentional pathname expansion. Add additional sanity checks and increase the rigour of those that exist. For instance, blank values are no longer permitted and the tunnel_id parameter must match that of l2tpsession_*, in the case that l2tptunnel_* is defined. Add additional diagnostic messages while improving the clarity of those that already existed. This is achieved in some instances by being more precise and, in others, through the use of English that exhibits greater formality and consistency. At least one grammatical error was rectified. Simplify and refine the code in terms of both structure and syntax, and greatly reduce the number of (local) variables. As a byproduct, all complaints previously raised by shellcheck have been eliminated, save for the use of local, whose behaviour is not defined by POSIX. I have not attempted to eliminate the use of local because, for now, it continues to be used extensively throughout the netifrc codebase. Honour the exit status value of ip(8) for the "add" and "del" verbs, rather than parse STDERR. Optimise l2tp_post_stop() by refraining from executing ip(8) and awk(8) in the case that the interface cannot be identifed as a virtual one. Further, do not attempt to destroy the tunnels associated with an identified session in the case that the attempt to destroy the session has failed. Signed-off-by: Kerin Millar <kfm@plushkava.net> Bug: https://bugs.gentoo.org/890238 Signed-off-by: Sam James <sam@gentoo.org> net/l2tp.sh | 349 +++++++++++++++++++++++++++++++++++------------------------- 1 file changed, 206 insertions(+), 143 deletions(-) I do have a tinderbox here where gawk was re-emerged after mawk was emerged, yielding into broken awk symlink:
# grep awk task.20230304-140722._world.log
[ebuild R ] sys-apps/gawk-5.2.1::gentoo USE="nls readline verify-sig* -mpfr -pma" 0 KiB
[nomerge ] app-alternatives/awk-4::gentoo USE="mawk* (split-usr) -busybox -gawk* -nawk"
[ebuild N ] sys-apps/mawk-1.3.4_p20230203::gentoo USE="verify-sig" 0 KiB
[ebuild R ] app-alternatives/awk-4::gentoo USE="mawk* (split-usr) -busybox -gawk* -nawk" 0 KiB
[nomerge ] sys-apps/gawk-5.2.1::gentoo USE="nls readline verify-sig* -mpfr -pma"
[ebuild N ] sec-keys/openpgp-keys-gawk-20220407::gentoo 0 KiB
>>> Emerging (37 of 179) sec-keys/openpgp-keys-gawk-20220407::gentoo
>>> Installing (37 of 179) sec-keys/openpgp-keys-gawk-20220407::gentoo
>>> Completed (37 of 179) sec-keys/openpgp-keys-gawk-20220407::gentoo
>>> Emerging (101 of 179) app-alternatives/awk-4::gentoo
>>> Installing (101 of 179) app-alternatives/awk-4::gentoo
>>> Completed (101 of 179) app-alternatives/awk-4::gentoo
./config.status: line 1069: awk: command not found
# grep awk /var/log/emerge.log
1677939588: >>> emerge (37 of 179) sec-keys/openpgp-keys-gawk-20220407 to /
1677939588: === (37 of 179) Cleaning (sec-keys/openpgp-keys-gawk-20220407::/var/db/repos/gentoo/sec-keys/openpgp-keys-gawk/openpgp-keys-gawk-20220407.ebuild)
1677939589: === (37 of 179) Compiling/Merging (sec-keys/openpgp-keys-gawk-20220407::/var/db/repos/gentoo/sec-keys/openpgp-keys-gawk/openpgp-keys-gawk-20220407.ebuild)
1677939591: === (37 of 179) Merging (sec-keys/openpgp-keys-gawk-20220407::/var/db/repos/gentoo/sec-keys/openpgp-keys-gawk/openpgp-keys-gawk-20220407.ebuild)
1677939592: >>> AUTOCLEAN: sec-keys/openpgp-keys-gawk:0
1677939593: === (37 of 179) Post-Build Cleaning (sec-keys/openpgp-keys-gawk-20220407::/var/db/repos/gentoo/sec-keys/openpgp-keys-gawk/openpgp-keys-gawk-20220407.ebuild)
1677939593: ::: completed emerge (37 of 179) sec-keys/openpgp-keys-gawk-20220407 to /
1677940719: >>> emerge (101 of 179) app-alternatives/awk-4 to /
1677940719: === (101 of 179) Cleaning (app-alternatives/awk-4::/var/db/repos/gentoo/app-alternatives/awk/awk-4.ebuild)
1677940719: === (101 of 179) Compiling/Merging (app-alternatives/awk-4::/var/db/repos/gentoo/app-alternatives/awk/awk-4.ebuild)
1677940722: === (101 of 179) Merging (app-alternatives/awk-4::/var/db/repos/gentoo/app-alternatives/awk/awk-4.ebuild)
1677940723: >>> AUTOCLEAN: app-alternatives/awk:0
1677940723: === Unmerging... (app-alternatives/awk-4)
1677940724: >>> unmerge success: app-alternatives/awk-4
1677940727: === (101 of 179) Post-Build Cleaning (app-alternatives/awk-4::/var/db/repos/gentoo/app-alternatives/awk/awk-4.ebuild)
1677940727: ::: completed emerge (101 of 179) app-alternatives/awk-4 to /
# ls -l /usr/bin/*awk*
lrwxrwxrwx 1 root root 4 Mar 4 14:38 /usr/bin/awk -> mawk
-rwxr-xr-x 1 root root 671304 Jan 1 17:32 /usr/bin/gawk
-rwxr-xr-x 1 root root 6613 Jan 1 17:32 /usr/bin/gawkbug
(image 17.1_systemd-j5-20230304-130004)
toralf: could you file another bug for that? Thanks! The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=04e95bd55dcb4d638c5b8814c994904308926598 commit 04e95bd55dcb4d638c5b8814c994904308926598 Author: Sam James <sam@gentoo.org> AuthorDate: 2023-04-17 04:39:50 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2023-04-17 04:41:25 +0000 net-misc/netifrc: add 0.7.4 Closes: https://bugs.gentoo.org/904422 Closes: https://bugs.gentoo.org/893290 Closes: https://bugs.gentoo.org/890238 Closes: https://bugs.gentoo.org/889922 Signed-off-by: Sam James <sam@gentoo.org> net-misc/netifrc/Manifest | 1 + net-misc/netifrc/netifrc-0.7.4.ebuild | 74 +++++++++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+) |