From bugzilla at busybox.net Mon Feb 5 08:36:24 2024 From: bugzilla at busybox.net (bugzilla at busybox.net) Date: Mon, 05 Feb 2024 08:36:24 +0000 Subject: [Bug 15937] New: When executing a specific script using hush, a segment fault occurs Message-ID: https://bugs.busybox.net/show_bug.cgi?id=15937 Bug ID: 15937 Summary: When executing a specific script using hush, a segment fault occurs Product: Busybox Version: 1.35.x Hardware: PC OS: Linux Status: NEW Severity: normal Priority: P5 Component: Standard Compliance Assignee: unassigned at busybox.net Reporter: 18751941738 at 163.com CC: busybox-cvs at busybox.net Target Milestone: --- The hush script is as follows,The for loop is missing the done keyword for i in `seq 1 10` do echo $i When executing this script using busybox hush ./test.sh,segment fault occurs. -- You are receiving this mail because: You are on the CC list for the bug. From bugzilla at busybox.net Mon Feb 5 08:41:29 2024 From: bugzilla at busybox.net (bugzilla at busybox.net) Date: Mon, 05 Feb 2024 08:41:29 +0000 Subject: [Bug 15937] When executing a specific script using hush, a segment fault occurs In-Reply-To: References: Message-ID: https://bugs.busybox.net/show_bug.cgi?id=15937 --- Comment #1 from zhangjiangang <18751941738 at 163.com> --- Created attachment 9703 --> https://bugs.busybox.net/attachment.cgi?id=9703&action=edit segment fault picture -- You are receiving this mail because: You are on the CC list for the bug. From bugzilla at busybox.net Wed Feb 7 01:22:22 2024 From: bugzilla at busybox.net (bugzilla at busybox.net) Date: Wed, 07 Feb 2024 01:22:22 +0000 Subject: [Bug 15940] New: jobs omits the last job when run from a subshell Message-ID: https://bugs.busybox.net/show_bug.cgi?id=15940 Bug ID: 15940 Summary: jobs omits the last job when run from a subshell Product: Busybox Version: 1.36.x Hardware: Macintosh OS: Linux Status: NEW Severity: normal Priority: P5 Component: Other Assignee: unassigned at busybox.net Reporter: cheery.hope5461 at fastmail.com CC: busybox-cvs at busybox.net Target Milestone: --- Test (to be run from an interactive shell): vim & vim & echo no subshell jobs echo subshell j="$(jobs)" echo "$j" Output: [1] 10523 [2] 10524 no subshell [1] - running vim [2] + running vim subshell [1] - running vim Expected output: [1] 10523 [2] 10524 no subshell [1] - running vim [2] + running vim subshell [1] - running vim [2] + running vim # <- this is missing when jobs is run from a subshell -- You are receiving this mail because: You are on the CC list for the bug. From bugzilla at busybox.net Tue Feb 13 18:06:27 2024 From: bugzilla at busybox.net (bugzilla at busybox.net) Date: Tue, 13 Feb 2024 18:06:27 +0000 Subject: [Bug 15925] [Website] RSS / Atom support to be notified about the next tags version ? In-Reply-To: References: Message-ID: https://bugs.busybox.net/show_bug.cgi?id=15925 --- Comment #1 from Bernhard Reutner-Fischer --- Hi! As far as i can see cgit does not support generating atoms for refs/tags (yet). As you probably have seen, you can have atoms for the _commits_ of an individual branch or tag: https://git.zx2c4.com/cgit/atom?h=refs/tags/v1.2.3 But you want something like: https://git.zx2c4.com/cgit/atom?h=refs/tags [gives Invalid branch: refs/tags] It tries to treat refs/tags as a branch to read commits off, or something like that. I would suggest that you look at cgit and maybe propose a patch to support what you ask for? Short of (proper) cgit support for atom feeds of tags, the busybox-cvs mailing-list does see mails that stem from tagging; e.g.: http://lists.busybox.net/pipermail/busybox-cvs/2023-January/041372.html I do not know offhand if we still pipe commits (and thus new tags) to the buildroot IRC channel. If we do, then you might use those as an alternative to the -cvs ML mentioned above. HTH -- You are receiving this mail because: You are on the CC list for the bug. From bugzilla at busybox.net Fri Feb 16 17:55:45 2024 From: bugzilla at busybox.net (bugzilla at busybox.net) Date: Fri, 16 Feb 2024 17:55:45 +0000 Subject: [Bug 15946] New: ash: command substitution hangs indefinitely inside `command_not_found_handle` Message-ID: https://bugs.busybox.net/show_bug.cgi?id=15946 Bug ID: 15946 Summary: ash: command substitution hangs indefinitely inside `command_not_found_handle` Product: Busybox Version: 1.37.x Hardware: Other OS: Linux Status: NEW Severity: normal Priority: P5 Component: Standard Compliance Assignee: unassigned at busybox.net Reporter: jyn514 at gmail.com CC: busybox-cvs at busybox.net Target Milestone: --- ``` -bash>git rev-parse HEAD 2d4a3d9e6c1493a9520b907e07a41aca90cdfd94 -bash>./busybox ash + ./busybox ash ash>command_not_found_handle() { echo "entered handle"; x=$(true); echo "finished handle"; } ash>set -x ash>does_not_exist + does_not_exist + echo 'entered handle' entered handle + true /* ... */ ``` i am on alpine linux. i first ran into this with the 1.33.1 release of busybox, but it's also present on 1.36.0 and the latest master commit. ``` -bash>uname -a Linux linode-static 5.10.176-0-virt #1-Alpine SMP Thu, 23 Mar 2023 10:33:44 +0000 x86_64 Linux ``` for some reason this only happens if `command_not_found_handle` is executed *in the context* of a missing command. if i run it directly, it works fine: ``` ash>command_not_found_handle entered handle finished handle ``` i glanced around `shell/ash.c` and i wonder if `find_command` needs to check the return code of `evalfun` so it can longjmp to exception_handler? at least, that patch seems to work for me locally: ```diff diff --git a/shell/ash.c b/shell/ash.c index 5f8c8ea19..a65773876 100644 --- a/shell/ash.c +++ b/shell/ash.c @@ -13920,7 +13920,9 @@ find_command(char *name, struct cmdentry *entry, int act, const char *path) argv[0] = (char*) "command_not_found_handle"; argv[1] = name; argv[2] = NULL; - evalfun(hookp->param.func, 2, argv, 0); + if (evalfun(hookp->param.func, 2, argv, 0)) { + longjmp(exception_handler->loc, 1); + } entry->cmdtype = CMDUNKNOWN; return; } ``` -- You are receiving this mail because: You are on the CC list for the bug. From bugzilla at busybox.net Sat Feb 17 03:54:03 2024 From: bugzilla at busybox.net (bugzilla at busybox.net) Date: Sat, 17 Feb 2024 03:54:03 +0000 Subject: [Bug 15949] New: First. sending invalid pointer to 'struct tm' to strftime causes crash. Second, DoS because of stack exhaustion in glibc regcomp which occurs because of unverified pattern being sent. Message-ID: https://bugs.busybox.net/show_bug.cgi?id=15949 Bug ID: 15949 Summary: First. sending invalid pointer to 'struct tm' to strftime causes crash. Second, DoS because of stack exhaustion in glibc regcomp which occurs because of unverified pattern being sent. Product: Busybox Version: 1.36.x Hardware: All OS: Linux Status: NEW Severity: normal Priority: P5 Component: Other Assignee: unassigned at busybox.net Reporter: aasmita at ucdavis.edu CC: busybox-cvs at busybox.net Target Milestone: --- This was identified while testing awk applet of BusyBox v1.36.1. 1. There is no error handling when 'awk' applet receives a command with wrong pattern like 'BEGIN{strftime("", "3333333333333333333")}', where the 'struct tm' is NULL, and format specifier is not correct, and overall arg passed to strftime is not correct. It leads to segmentation fault. 2. The pattern being passed to regcomp() is not being verified. As pattern like : '/1((((((..12208 times/1' in regcomp() causes denial of service (DoS) by stack exhaustion. Triggers deep recursion that causes stack exhaustion. The crash pattern and corresponding segfault screenshot are attached. -- You are receiving this mail because: You are on the CC list for the bug. From bugzilla at busybox.net Sat Feb 17 03:56:11 2024 From: bugzilla at busybox.net (bugzilla at busybox.net) Date: Sat, 17 Feb 2024 03:56:11 +0000 Subject: [Bug 15949] First. sending invalid pointer to 'struct tm' to strftime causes crash. Second, DoS because of stack exhaustion in glibc regcomp which occurs because of unverified pattern being sent. In-Reply-To: References: Message-ID: https://bugs.busybox.net/show_bug.cgi?id=15949 Asmita changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |aasmita at ucdavis.edu --- Comment #1 from Asmita --- Created attachment 9706 --> https://bugs.busybox.net/attachment.cgi?id=9706&action=edit contains crash patterns, and the screenshot of gdb output -- You are receiving this mail because: You are on the CC list for the bug. From bugzilla at busybox.net Sat Feb 17 03:56:36 2024 From: bugzilla at busybox.net (bugzilla at busybox.net) Date: Sat, 17 Feb 2024 03:56:36 +0000 Subject: [Bug 15949] First. sending invalid pointer to 'struct tm' to strftime causes crash. Second, DoS because of stack exhaustion in glibc regcomp which occurs because of unverified pattern being sent. In-Reply-To: References: Message-ID: https://bugs.busybox.net/show_bug.cgi?id=15949 --- Comment #2 from Asmita --- Created attachment 9709 --> https://bugs.busybox.net/attachment.cgi?id=9709&action=edit crash_pattern_strftime -- You are receiving this mail because: You are on the CC list for the bug. From bugzilla at busybox.net Sat Feb 17 03:57:36 2024 From: bugzilla at busybox.net (bugzilla at busybox.net) Date: Sat, 17 Feb 2024 03:57:36 +0000 Subject: [Bug 15949] First. sending invalid pointer to 'struct tm' to strftime causes crash. Second, DoS because of stack exhaustion in glibc regcomp which occurs because of unverified pattern being sent. In-Reply-To: References: Message-ID: https://bugs.busybox.net/show_bug.cgi?id=15949 --- Comment #3 from Asmita --- Created attachment 9712 --> https://bugs.busybox.net/attachment.cgi?id=9712&action=edit crash pattern regcomp -- You are receiving this mail because: You are on the CC list for the bug. From bugzilla at busybox.net Wed Feb 21 02:18:04 2024 From: bugzilla at busybox.net (bugzilla at busybox.net) Date: Wed, 21 Feb 2024 02:18:04 +0000 Subject: [Bug 15955] New: busybox xargs has very odd behavior with -P and processes that exit with exit status 255 Message-ID: https://bugs.busybox.net/show_bug.cgi?id=15955 Bug ID: 15955 Summary: busybox xargs has very odd behavior with -P and processes that exit with exit status 255 Product: Busybox Version: 1.37.x Hardware: All OS: All Status: NEW Severity: normal Priority: P5 Component: Other Assignee: unassigned at busybox.net Reporter: gabravier at gmail.com CC: busybox-cvs at busybox.net Target Milestone: --- Running the following results in extremely odd behavior from busybox (which should be relatively consistent unless your system is so slow that spawning 4 processes, printing a number and exiting takes more than an entire second to do): $ echo $(seq 1 100) | busybox xargs -n1 -P10 -- sh -c 'sleep "$0"; echo "$0"; [ "$0" = 2 ] && exit 0 || exit 255' 1 xargs: sh: exited with status 255; aborting 2 3 xargs: sh: exited with status 255; aborting $ 4 5 6 7 8 9 10 I would expect such a command line to result in one of the following: 1. xargs writes a diagnostic and waits for currently running invocations to exit before terminating, and prints more diagnostics if other invocations also exit with exit status 255 2. xargs writes a diagnostic and exits immediately, leaving the remaining currently running invocations orphaned 3. xargs writes a diagnostic and exits immediately after killing the remaining invocations still running Instead, xargs writes a diagnostic and waits for currently running invocations to exit, but if another invocation exits with exit status 255, it exits immediately, leaving the remaining currently running invocations orphaned, which seems like quite strange behavior, which I believe should be modified to be more sensible. PS: I have no particular preference for a specific option out of the three given above, especially given existing implementations are very divergent in this regard, although I would find 3. less attractive given it seems more likely to have unexpected results and no existing implementation behaves as such. PS 2: w.r.t. existing implementations: - GNU findutils does the same thing as busybox on my machine through pure happenstance, as in this situation it invokes undefined behavior by calling exit from an atexit handler and that happens to make it exit the second time it sees a process exiting with exit status 255 - FreeBSD does 1. - OpenBSD and illumos do 2. - Toybox is completely broken and doesn't end processing at all when it sees a process exiting with exit status 255, even though it prints a diagnostic -- You are receiving this mail because: You are on the CC list for the bug. From bugzilla at busybox.net Wed Feb 21 16:32:52 2024 From: bugzilla at busybox.net (bugzilla at busybox.net) Date: Wed, 21 Feb 2024 16:32:52 +0000 Subject: [Bug 15955] busybox xargs has very odd behavior with -P and processes that exit with exit status 255 In-Reply-To: References: Message-ID: https://bugs.busybox.net/show_bug.cgi?id=15955 --- Comment #1 from Gabriel Ravier --- I'll add that toybox has now fixed their implementation and it now behaves like FreeBSD in this case. -- You are receiving this mail because: You are on the CC list for the bug. From vda.linux at googlemail.com Sun Feb 25 00:06:30 2024 From: vda.linux at googlemail.com (Denys Vlasenko) Date: Sun, 25 Feb 2024 01:06:30 +0100 Subject: [git commit] ls: do not truncate username/groupname to 8 chars Message-ID: <20240225000658.2C69187A6D@busybox.osuosl.org> commit: https://git.busybox.net/busybox/commit/?id=a97a2f12804668435e05cf98ae43e3a81e3da041 branch: https://git.busybox.net/busybox/commit/?id=refs/heads/master function old new delta .rodata 105412 105408 -4 Signed-off-by: Denys Vlasenko --- coreutils/ls.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/coreutils/ls.c b/coreutils/ls.c index b69b80460..cc809b797 100644 --- a/coreutils/ls.c +++ b/coreutils/ls.c @@ -526,10 +526,10 @@ static NOINLINE unsigned display_single(const struct dnode *dn) #if ENABLE_FEATURE_LS_USERNAME else { if (opt & OPT_g) { - column += printf("%-8.8s ", + column += printf("%-8s ", get_cached_groupname(dn->dn_gid)); } else { - column += printf("%-8.8s %-8.8s ", + column += printf("%-8s %-8s ", get_cached_username(dn->dn_uid), get_cached_groupname(dn->dn_gid)); } From vda.linux at googlemail.com Sun Feb 25 14:42:16 2024 From: vda.linux at googlemail.com (Denys Vlasenko) Date: Sun, 25 Feb 2024 15:42:16 +0100 Subject: [git commit] hush: set G.ifs sooner (prevents segfault) Message-ID: <20240225144347.5AD1787AAD@busybox.osuosl.org> commit: https://git.busybox.net/busybox/commit/?id=2639f3bc72ac2f03af7ccc825429ccb2fce99a16 branch: https://git.busybox.net/busybox/commit/?id=refs/heads/master function old new delta set_G_ifs - 151 +151 run_list 1024 1031 +7 run_pipe 1567 1445 -122 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 1/1 up/down: 158/-122) Total: 36 bytes Signed-off-by: Denys Vlasenko --- shell/hush.c | 62 +++++++++++++++++++++++++++++++++--------------------------- 1 file changed, 34 insertions(+), 28 deletions(-) diff --git a/shell/hush.c b/shell/hush.c index ca01e2b5b..0c91008b9 100644 --- a/shell/hush.c +++ b/shell/hush.c @@ -9250,6 +9250,37 @@ static int checkjobs_and_fg_shell(struct pipe *fg_pipe) * backgrounded: cmd & { list } & * subshell: ( list ) [&] */ +static void set_G_ifs(void) +{ + /* Testcase: set -- q w e; (IFS='' echo "$*"; IFS=''; echo "$*"); echo "$*" + * Result should be 3 lines: q w e, qwe, q w e + */ + if (G.ifs_whitespace != G.ifs) + free(G.ifs_whitespace); + G.ifs = get_local_var_value("IFS"); + if (G.ifs) { + char *p; + G.ifs_whitespace = (char*)G.ifs; + p = skip_whitespace(G.ifs); + if (*p) { + /* Not all $IFS is whitespace */ + char *d; + int len = p - G.ifs; + p = skip_non_whitespace(p); + G.ifs_whitespace = xmalloc(len + strlen(p) + 1); /* can overestimate */ + d = mempcpy(G.ifs_whitespace, G.ifs, len); + while (*p) { + if (isspace(*p)) + *d++ = *p; + p++; + } + *d = '\0'; + } + } else { + G.ifs = defifs; + G.ifs_whitespace = (char*)G.ifs; + } +} #if !ENABLE_HUSH_MODE_X #define redirect_and_varexp_helper(command, sqp, argv_expanded) \ redirect_and_varexp_helper(command, sqp) @@ -9286,34 +9317,7 @@ static NOINLINE int run_pipe(struct pipe *pi) debug_printf_exec("run_pipe start: members:%d\n", pi->num_cmds); debug_enter(); - /* Testcase: set -- q w e; (IFS='' echo "$*"; IFS=''; echo "$*"); echo "$*" - * Result should be 3 lines: q w e, qwe, q w e - */ - if (G.ifs_whitespace != G.ifs) - free(G.ifs_whitespace); - G.ifs = get_local_var_value("IFS"); - if (G.ifs) { - char *p; - G.ifs_whitespace = (char*)G.ifs; - p = skip_whitespace(G.ifs); - if (*p) { - /* Not all $IFS is whitespace */ - char *d; - int len = p - G.ifs; - p = skip_non_whitespace(p); - G.ifs_whitespace = xmalloc(len + strlen(p) + 1); /* can overestimate */ - d = mempcpy(G.ifs_whitespace, G.ifs, len); - while (*p) { - if (isspace(*p)) - *d++ = *p; - p++; - } - *d = '\0'; - } - } else { - G.ifs = defifs; - G.ifs_whitespace = (char*)G.ifs; - } + set_G_ifs(); IF_HUSH_JOB(pi->pgrp = -1;) pi->stopped_cmds = 0; @@ -9758,6 +9762,8 @@ static int run_list(struct pipe *pi) debug_printf_exec("run_list lvl %d start\n", G.run_list_level); debug_enter(); + set_G_ifs(); + #if ENABLE_HUSH_LOOPS /* Check syntax for "for" */ { From vda.linux at googlemail.com Sun Feb 25 16:53:25 2024 From: vda.linux at googlemail.com (Denys Vlasenko) Date: Sun, 25 Feb 2024 17:53:25 +0100 Subject: [git commit] hush: detect when terminating "done"/"fi" is missing Message-ID: <20240225230826.DD58C87ACC@busybox.osuosl.org> commit: https://git.busybox.net/busybox/commit/?id=758b21402abc7015cfc54eb21a2e7eead1ecf6ba branch: https://git.busybox.net/busybox/commit/?id=refs/heads/master function old new delta parse_stream 2271 2292 +21 .rodata 105408 105427 +19 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 40/0) Total: 40 bytes Signed-off-by: Denys Vlasenko --- shell/ash_test/ash-parsing/nodone1.right | 1 + shell/ash_test/ash-parsing/nodone1.tests | 1 + shell/ash_test/ash-parsing/nodone2.right | 1 + shell/ash_test/ash-parsing/nodone2.tests | 3 +++ shell/hush.c | 11 ++++++++++- shell/hush_test/hush-parsing/nodone1.right | 1 + shell/hush_test/hush-parsing/nodone1.tests | 1 + shell/hush_test/hush-parsing/nodone2.right | 1 + shell/hush_test/hush-parsing/nodone2.tests | 3 +++ 9 files changed, 22 insertions(+), 1 deletion(-) diff --git a/shell/ash_test/ash-parsing/nodone1.right b/shell/ash_test/ash-parsing/nodone1.right new file mode 100644 index 000000000..0150ccad5 --- /dev/null +++ b/shell/ash_test/ash-parsing/nodone1.right @@ -0,0 +1 @@ +./nodone1.tests: line 2: syntax error: unexpected end of file (expecting "done") diff --git a/shell/ash_test/ash-parsing/nodone1.tests b/shell/ash_test/ash-parsing/nodone1.tests new file mode 100755 index 000000000..de286c5a2 --- /dev/null +++ b/shell/ash_test/ash-parsing/nodone1.tests @@ -0,0 +1 @@ +for i; do : diff --git a/shell/ash_test/ash-parsing/nodone2.right b/shell/ash_test/ash-parsing/nodone2.right new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/shell/ash_test/ash-parsing/nodone2.right @@ -0,0 +1 @@ +1 diff --git a/shell/ash_test/ash-parsing/nodone2.tests b/shell/ash_test/ash-parsing/nodone2.tests new file mode 100755 index 000000000..69537b3b1 --- /dev/null +++ b/shell/ash_test/ash-parsing/nodone2.tests @@ -0,0 +1,3 @@ +for i in 1; do echo $i +# the next line has no EOL. It still must count as "done" keyword: +done \ No newline at end of file diff --git a/shell/hush.c b/shell/hush.c index 0c91008b9..3e6a13b32 100644 --- a/shell/hush.c +++ b/shell/hush.c @@ -5497,6 +5497,15 @@ static struct pipe *parse_stream(char **pstring, } o_free_and_set_NULL(&ctx.word); done_pipe(&ctx, PIPE_SEQ); + + /* Do we sit inside of any if's, loops or case's? */ + if (HAS_KEYWORDS + IF_HAS_KEYWORDS(&& (ctx.ctx_res_w != RES_NONE || ctx.old_flag != 0)) + ) { + syntax_error_unterm_str("compound statement"); + goto parse_error_exitcode1; + } + pi = ctx.list_head; /* If we got nothing... */ /* (this makes bare "&" cmd a no-op. @@ -5519,7 +5528,7 @@ static struct pipe *parse_stream(char **pstring, // *heredoc_cnt_ptr = heredoc_cnt; debug_leave(); debug_printf_heredoc("parse_stream return heredoc_cnt:%d\n", heredoc_cnt); - debug_printf_parse("parse_stream return %p\n", pi); + debug_printf_parse("parse_stream return %p: EOF\n", pi); return pi; } diff --git a/shell/hush_test/hush-parsing/nodone1.right b/shell/hush_test/hush-parsing/nodone1.right new file mode 100644 index 000000000..3dc1bcfbe --- /dev/null +++ b/shell/hush_test/hush-parsing/nodone1.right @@ -0,0 +1 @@ +hush: syntax error: unterminated compound statement diff --git a/shell/hush_test/hush-parsing/nodone1.tests b/shell/hush_test/hush-parsing/nodone1.tests new file mode 100755 index 000000000..de286c5a2 --- /dev/null +++ b/shell/hush_test/hush-parsing/nodone1.tests @@ -0,0 +1 @@ +for i; do : diff --git a/shell/hush_test/hush-parsing/nodone2.right b/shell/hush_test/hush-parsing/nodone2.right new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/shell/hush_test/hush-parsing/nodone2.right @@ -0,0 +1 @@ +1 diff --git a/shell/hush_test/hush-parsing/nodone2.tests b/shell/hush_test/hush-parsing/nodone2.tests new file mode 100755 index 000000000..69537b3b1 --- /dev/null +++ b/shell/hush_test/hush-parsing/nodone2.tests @@ -0,0 +1,3 @@ +for i in 1; do echo $i +# the next line has no EOL. It still must count as "done" keyword: +done \ No newline at end of file From bugzilla at busybox.net Mon Feb 26 09:58:20 2024 From: bugzilla at busybox.net (bugzilla at busybox.net) Date: Mon, 26 Feb 2024 09:58:20 +0000 Subject: [Bug 15958] New: df returns info of a different filesystem when given a nfs4 mount Message-ID: https://bugs.busybox.net/show_bug.cgi?id=15958 Bug ID: 15958 Summary: df returns info of a different filesystem when given a nfs4 mount Product: Busybox Version: 1.36.x Hardware: Other OS: Linux Status: NEW Severity: normal Priority: P5 Component: Other Assignee: unassigned at busybox.net Reporter: jasper at swis.nl CC: busybox-cvs at busybox.net Target Milestone: --- When I give a nfs4 mount to df, it returns the info of a different nfs4 mount. Steps to Reproduce: ``` df -T -P /srv/storage/tenants ``` Actual results: ``` Filesystem 1024-blocks Used Available Capacity Mounted on 1.2.3.4:/trident_qtree_pool_trident_NRHEIFEKPZ/trident_pvc_d8f936df_cbd2_4a1e_93e0_f1511b114305 nfs4 2097152 177792 1919360 8% /tmp/nginx-cache ``` Expected results: ``` Filesystem 1024-blocks Used Available Capacity Mounted on 1.2.3.4:/trident_qtree_pool_trident_NRHEIFEKPZ/trident_pvc_ee130454_fadd_4903_aa15_776534a09982 nfs4 8388608 6531456 1857152 78% /srv/storage/tenants ``` Results without filesystem argument: ``` Filesystem Type 1024-blocks Used Available Capacity Mounted on overlay overlay 101430960 77708184 23706392 77% / tmpfs tmpfs 65536 0 65536 0% /dev /dev/vda1 ext4 101430960 77708184 23706392 77% /tmp tmpfs tmpfs 1048576 31108 1017468 3% /vault /dev/vda1 ext4 101430960 77708184 23706392 77% /dev/termination-log 87.233.240.117:/trident_qtree_pool_trident_NRHEIFEKPZ/trident_pvc_d8f936df_cbd2_4a1e_93e0_f1511b114305 nfs4 2097152 177792 1919360 8% /tmp/nginx-cache /dev/vda1 ext4 101430960 77708184 23706392 77% /srv/crontab /dev/vda1 ext4 101430960 77708184 23706392 77% /etc/hosts /dev/vda1 ext4 101430960 77708184 23706392 77% /etc/hostname /dev/vda1 ext4 101430960 77708184 23706392 77% /etc/resolv.conf shm tmpfs 65536 0 65536 0% /dev/shm /dev/vda1 ext4 101430960 77708184 23706392 77% /srv/bootstrap/cache 87.233.240.117:/trident_qtree_pool_trident_NRHEIFEKPZ/trident_pvc_ee130454_fadd_4903_aa15_776534a09982 nfs4 8388608 6531456 1857152 78% /srv/storage/tenants 87.233.240.117:/trident_qtree_pool_trident_NRHEIFEKPZ/trident_pvc_ae805cf1_f7b6_4d0e_9faf_ddeb206b8510 nfs4 131072 0 131072 0% /srv/storage/app /dev/vda1 ext4 101430960 77708184 23706392 77% /srv/storage/framework/cache /dev/vda1 ext4 101430960 77708184 23706392 77% /srv/storage/framework/views tmpfs tmpfs 1048576 12 1048564 0% /run/secrets/kubernetes.io/serviceaccount tmpfs tmpfs 4070128 0 4070128 0% /proc/acpi tmpfs tmpfs 65536 0 65536 0% /proc/kcore tmpfs tmpfs 65536 0 65536 0% /proc/keys tmpfs tmpfs 65536 0 65536 0% /proc/timer_list tmpfs tmpfs 4070128 0 4070128 0% /proc/scsi tmpfs tmpfs 4070128 0 4070128 0% /sys/firmware ``` Builds: Official PHP Docker image: php:8.1.27-fpm-alpine BusyBox v1.36.1 (2023-11-07 18:53:09 UTC) multi-call binary. Alpine v3.19.1 Environment: Container running in Kubernetes v1.26.6 Using Trident to mount NetApp storage -- You are receiving this mail because: You are on the CC list for the bug. From vda.linux at googlemail.com Mon Feb 26 13:10:10 2024 From: vda.linux at googlemail.com (Denys Vlasenko) Date: Mon, 26 Feb 2024 14:10:10 +0100 Subject: [git commit] ip link: support for the CAN netlink Message-ID: <20240226131321.E252D87AFB@busybox.osuosl.org> commit: https://git.busybox.net/busybox/commit/?id=f873c63085e3f3745040286999779077ccc03987 branch: https://git.busybox.net/busybox/commit/?id=refs/heads/master I developed this application to test the Linux kernel series [1]. As described in it I could not use the iproute2 package since the microcontroller is without MMU. function old new delta do_set_can - 920 +920 packed_usage 34645 34908 +263 get_float_1000 - 164 +164 .rodata 105427 105539 +112 do_iplink 1313 1381 +68 ------------------------------------------------------------------------------ (add/remove: 2/0 grow/shrink: 3/0 up/down: 1527/0) Total: 1527 bytes cc: Marc Kleine-Budde [1] https://marc.info/?l=linux-netdev&m=167999323611710&w=2 Signed-off-by: Dario Binacchi Signed-off-by: Denys Vlasenko --- configs/TEST_nommu_defconfig | 1 + networking/ip.c | 55 +++++++- networking/libiproute/iplink.c | 288 +++++++++++++++++++++++++++++++++++++++-- 3 files changed, 333 insertions(+), 11 deletions(-) diff --git a/configs/TEST_nommu_defconfig b/configs/TEST_nommu_defconfig index 415f5a802..fa3e96326 100644 --- a/configs/TEST_nommu_defconfig +++ b/configs/TEST_nommu_defconfig @@ -703,6 +703,7 @@ CONFIG_FEATURE_INETD_RPC=y CONFIG_IP=y CONFIG_FEATURE_IP_ADDRESS=y CONFIG_FEATURE_IP_LINK=y +CONFIG_FEATURE_IP_LINK_CAN=y CONFIG_FEATURE_IP_ROUTE=y CONFIG_FEATURE_IP_TUNNEL=y CONFIG_FEATURE_IP_RULE=y diff --git a/networking/ip.c b/networking/ip.c index 36126b747..02f93adbf 100644 --- a/networking/ip.c +++ b/networking/ip.c @@ -74,6 +74,12 @@ //config: help //config: Configure network devices with "ip". //config: +//config:config FEATURE_IP_LINK_CAN +//config: bool "ip link set type can" +//config: default y +//config: help +//config: Configure CAN devices with "ip". +//config: //config:config FEATURE_IP_ROUTE //config: bool "ip route" //config: default y @@ -152,16 +158,61 @@ //usage:#define iplink_trivial_usage //usage: /*Usage:iplink*/"set IFACE [up|down] [arp on|off] [multicast on|off]\n" //usage: " [promisc on|off] [mtu NUM] [name NAME] [qlen NUM] [address MAC]\n" -//usage: " [master IFACE | nomaster] [netns PID]" +//usage: " [master IFACE | nomaster] [netns PID]"IF_FEATURE_IP_LINK_CAN(" [type TYPE ARGS]") // * short help shows only "set" command, long help continues (with just one "\n") // * and shows all other commands: //usage:#define iplink_full_usage "\n" //usage: "iplink add [link IFACE] IFACE [address MAC] type TYPE [ARGS]\n" //usage: "iplink delete IFACE type TYPE [ARGS]\n" -//usage: " TYPE ARGS := vlan VLANARGS | vrf table NUM\n" +//usage: " TYPE ARGS := vlan VLANARGS | vrf table NUM"IF_FEATURE_IP_LINK_CAN(" | can CANARGS")"\n" //usage: " VLANARGS := id VLANID [protocol 802.1q|802.1ad] [reorder_hdr on|off]\n" //usage: " [gvrp on|off] [mvrp on|off] [loose_binding on|off]\n" +//usage: IF_FEATURE_IP_LINK_CAN( +//usage: " CANARGS := [bitrate BITRATE [sample-point SAMPLE-POINT]] |\n" +//usage: " [tq TQ prop-seg PROP_SEG phase-seg1 PHASE-SEG1\n" +//usage: " phase-seg2 PHASE-SEG2 [sjw SJW]]\n" +//usage: " [dbitrate BITRATE [dsample-point SAMPLE-POINT]] |\n" +//usage: " [dtq TQ dprop-seg PROP_SEG dphase-seg1 PHASE-SEG1\n" +//usage: " dphase-seg2 PHASE-SEG2 [dsjw SJW]]\n" +//usage: " [loopback on|off] [listen-only on|off] [triple-sampling on|off]\n" +//usage: " [one-shot on|off] [berr-reporting on|off]\n" +//usage: " [fd on|off] [fd-non-iso on|off] [presume-ack on|off]\n" +//usage: " [restart-ms TIME-MS] [restart]\n" +//usage: " [termination 0..65535]\n" +//usage: ) //usage: "iplink show [IFACE]" +//upstream man ip-link-can: +//Usage: ip link set DEVICE type can +// [ bitrate BITRATE [ sample-point SAMPLE-POINT] ] | +// [ tq TQ prop-seg PROP_SEG phase-seg1 PHASE-SEG1 +// phase-seg2 PHASE-SEG2 [ sjw SJW ] ] +// +// [ dbitrate BITRATE [ dsample-point SAMPLE-POINT] ] | +// [ dtq TQ dprop-seg PROP_SEG dphase-seg1 PHASE-SEG1 +// dphase-seg2 PHASE-SEG2 [ dsjw SJW ] ] +// +// [ loopback { on | off } ] +// [ listen-only { on | off } ] +// [ triple-sampling { on | off } ] +// [ one-shot { on | off } ] +// [ berr-reporting { on | off } ] +// [ fd { on | off } ] +// [ fd-non-iso { on | off } ] +// [ presume-ack { on | off } ] +// +// [ restart-ms TIME-MS ] +// [ restart ] +// +// [ termination { 0..65535 } ] +// +// Where: BITRATE := { 1..1000000 } +// SAMPLE-POINT := { 0.000..0.999 } +// TQ := { NUMBER } +// PROP-SEG := { 1..8 } +// PHASE-SEG1 := { 1..8 } +// PHASE-SEG2 := { 1..8 } +// SJW := { 1..4 } +// RESTART-MS := { 0 | NUMBER } //upstream man ip-link: //===================== //ip link add [link DEV] [ name ] NAME diff --git a/networking/libiproute/iplink.c b/networking/libiproute/iplink.c index 9eb0b4f5f..37ed114bc 100644 --- a/networking/libiproute/iplink.c +++ b/networking/libiproute/iplink.c @@ -11,6 +11,9 @@ #include #include +#if ENABLE_FEATURE_IP_LINK_CAN +# include +#endif #include "ip_common.h" /* #include "libbb.h" is inside */ #include "rt_names.h" #include "utils.h" @@ -28,6 +31,11 @@ #undef IFLA_VLAN_PROTOCOL #define IFLA_VLAN_PROTOCOL 5 +#ifndef NLMSG_TAIL +#define NLMSG_TAIL(nmsg) \ + ((struct rtattr *) (((void *) (nmsg)) + NLMSG_ALIGN((nmsg)->nlmsg_len))) +#endif + #ifndef IFLA_LINKINFO # define IFLA_LINKINFO 18 # define IFLA_INFO_KIND 1 @@ -55,6 +63,11 @@ struct ifla_vlan_flags { #define str_on_off "on\0""off\0" +enum { + PARM_on = 0, + PARM_off +}; + /* Exits on error */ static int get_ctl_fd(void) { @@ -241,10 +254,257 @@ static void die_must_be_on_off(const char *msg) bb_error_msg_and_die("argument of \"%s\" must be \"on\" or \"off\"", msg); } +#if ENABLE_FEATURE_IP_LINK_CAN +static uint32_t get_float_1000(char *arg, const char *errmsg) +{ + uint32_t ret; + double d; + char *ptr; + + errno = 0; +//TODO: needs setlocale(LC_NUMERIC, "C")? + d = strtod(arg, &ptr); + if (errno || ptr == arg || *ptr + || d > (0xFFFFFFFFU / 1000) || d < 0 + ) { + invarg_1_to_2(arg, errmsg); /* does not return */ + } + ret = d * 1000; + + return ret; +} + +static void do_set_can(char *dev, char **argv) +{ + struct can_bittiming bt = {}, dbt = {}; + struct can_ctrlmode cm = {}; + char *keyword; + static const char keywords[] ALIGN1 = + "bitrate\0""sample-point\0""tq\0" + "prop-seg\0""phase-seg1\0""phase-seg2\0""sjw\0" + "dbitrate\0""dsample-point\0""dtq\0" + "dprop-seg\0""dphase-seg1\0""dphase-seg2\0""dsjw\0" + "loopback\0""listen-only\0""triple-sampling\0" + "one-shot\0""berr-reporting\0" + "fd\0""fd-non-iso\0""presume-ack\0" + "cc-len8-dlc\0""restart\0""restart-ms\0" + "termination\0"; + enum { ARG_bitrate = 0, ARG_sample_point, ARG_tq, + ARG_prop_seg, ARG_phase_seg1, ARG_phase_seg2, ARG_sjw, + ARG_dbitrate, ARG_dsample_point, ARG_dtq, + ARG_dprop_seg, ARG_dphase_seg1, ARG_dphase_seg2, ARG_dsjw, + ARG_loopback, ARG_listen_only, ARG_triple_sampling, + ARG_one_shot, ARG_berr_reporting, + ARG_fd, ARG_fd_non_iso, ARG_presume_ack, + ARG_cc_len8_dlc, ARG_restart, ARG_restart_ms, + ARG_termination }; + struct rtnl_handle rth; + struct { + struct nlmsghdr n; + struct ifinfomsg i; + char buf[1024]; + } req; + size_t dev_len; + struct rtattr *linkinfo, *data; + smalluint key, param; + + memset(&req, 0, sizeof(req)); + + req.n.nlmsg_len = NLMSG_LENGTH(sizeof(struct ifinfomsg)); + req.n.nlmsg_flags = NLM_F_REQUEST; + req.n.nlmsg_type = RTM_NEWLINK; + req.i.ifi_family = preferred_family; + xrtnl_open(&rth); + req.i.ifi_index = xll_name_to_index(dev); + dev_len = strlen(dev); + if (dev_len < 2 || dev_len > IFNAMSIZ) + invarg_1_to_2(dev, "dev"); + + addattr_l(&req.n, sizeof(req), IFLA_IFNAME, dev, dev_len); + linkinfo = NLMSG_TAIL(&req.n); + addattr_l(&req.n, sizeof(req), IFLA_LINKINFO, NULL, 0); + addattr_l(&req.n, sizeof(req), IFLA_INFO_KIND, (void *)"can", + strlen("can")); + data = NLMSG_TAIL(&req.n); + addattr_l(&req.n, sizeof(req), IFLA_INFO_DATA, NULL, 0); + while (*argv) { + key = index_in_substrings(keywords, *argv); + keyword = *argv; + //printf("%s: key: %d, *argv: %s\n", __func__, key, *argv); + switch (key) { + case ARG_bitrate: + case ARG_tq: + case ARG_prop_seg: + case ARG_phase_seg1: + case ARG_phase_seg2: + case ARG_sjw: { + uint32_t *val; + NEXT_ARG(); + if (key == ARG_bitrate) + val = &bt.bitrate; + else if (key == ARG_tq) + val = &bt.tq; + else if (key == ARG_prop_seg) + val = &bt.prop_seg; + else if (key == ARG_phase_seg1) + val = &bt.phase_seg1; + else if (key == ARG_phase_seg2) + val = &bt.phase_seg2; + else + val = &bt.sjw; + + *val = get_u32(*argv, keyword); + break; + } + case ARG_sample_point: { + NEXT_ARG(); + bt.sample_point = get_float_1000(*argv, keyword); + break; + } + case ARG_dbitrate: + case ARG_dtq: + case ARG_dprop_seg: + case ARG_dphase_seg1: + case ARG_dphase_seg2: + case ARG_dsjw: { + uint32_t *val; + NEXT_ARG(); + if (key == ARG_dbitrate) + val = &dbt.bitrate; + else if (key == ARG_dtq) + val = &dbt.tq; + else if (key == ARG_dprop_seg) + val = &dbt.prop_seg; + else if (key == ARG_dphase_seg1) + val = &dbt.phase_seg1; + else if (key == ARG_dphase_seg2) + val = &dbt.phase_seg2; + else + val = &dbt.sjw; + + *val = get_u32(*argv, keyword); + break; + } + case ARG_dsample_point: { + NEXT_ARG(); + dbt.sample_point = get_float_1000(*argv, keyword); + break; + } + case ARG_loopback: + case ARG_listen_only: + case ARG_triple_sampling: + case ARG_one_shot: + case ARG_berr_reporting: + case ARG_fd: + case ARG_fd_non_iso: + case ARG_presume_ack: + case ARG_cc_len8_dlc: { + uint32_t flag = 0; + + NEXT_ARG(); + param = index_in_strings(str_on_off, *argv); + if (param < 0) + die_must_be_on_off(keyword); + + if (key == ARG_loopback) + flag = CAN_CTRLMODE_LOOPBACK; + else if (key == ARG_listen_only) + flag = CAN_CTRLMODE_LISTENONLY; + else if (key == ARG_triple_sampling) + flag = CAN_CTRLMODE_3_SAMPLES; + else if (key == ARG_one_shot) + flag = CAN_CTRLMODE_ONE_SHOT; + else if (key == ARG_berr_reporting) + flag = CAN_CTRLMODE_BERR_REPORTING; + else if (key == ARG_fd) + flag = CAN_CTRLMODE_FD; + else if (key == ARG_fd_non_iso) + flag = CAN_CTRLMODE_FD_NON_ISO; + else if (key == ARG_presume_ack) + flag = CAN_CTRLMODE_PRESUME_ACK; + else +#if defined(CAN_CTRLMODE_CC_LEN8_DLC) + flag = CAN_CTRLMODE_CC_LEN8_DLC; +#else + die_must_be_on_off(keyword); +#endif + cm.mask |= flag; + if (param == PARM_on) + cm.flags |= flag; + + break; + } + case ARG_restart: { + uint32_t val = 1; + /*NEXT_ARG(); - WRONG? */ + addattr_l(&req.n, sizeof(req), IFLA_CAN_RESTART, &val, sizeof(val)); + break; + } + case ARG_restart_ms: { + uint32_t val; + NEXT_ARG(); + val = get_u32(*argv, keyword); + addattr_l(&req.n, sizeof(req), IFLA_CAN_RESTART_MS, &val, sizeof(val)); + break; + } + case ARG_termination: { + uint16_t val; + NEXT_ARG(); + val = get_u16(*argv, keyword); + addattr_l(&req.n, sizeof(req), IFLA_CAN_TERMINATION, &val, sizeof(val)); + break; + } + default: + break; + } + argv++; + } + + if (bt.bitrate || bt.tq) + addattr_l(&req.n, sizeof(req), IFLA_CAN_BITTIMING, &bt, sizeof(bt)); + + if (cm.mask) + addattr_l(&req.n, sizeof(req), IFLA_CAN_CTRLMODE, &cm, sizeof(cm)); + + data->rta_len = (void *)NLMSG_TAIL(&req.n) - (void *)data; + linkinfo->rta_len = (void *)NLMSG_TAIL(&req.n) - (void *)linkinfo; + + if (rtnl_talk(&rth, &req.n, 0, 0, NULL, NULL, NULL) < 0) + xfunc_die(); +} + +static void set_type(char *type, char *dev, char **argv) +{ +/* When we have more than just "type can ARGS" supported, maybe: + static const char keywords[] ALIGN1 = "" + IF_FEATURE_IP_LINK_CAN("can\0") + ; + typedef void FAST_FUNC(*ip_type_set_func_ptr_t)(char*, char**); + static const ip_type_set_func_ptr_t funcs[] ALIGN_PTR = { + IF_FEATURE_IP_LINK_CAN(do_set_can,) + }; + ip_type_set_func_ptr_t func; + int key; + + key = index_in_substrings(keywords, type); + if (key < 0) + invarg_1_to_2(type, "type"); + func = funcs[key]; + func(dev, argv); +*/ + if (strcmp(type, "can") != 0) + invarg_1_to_2(type, "type"); + do_set_can(dev, argv); +} +#endif + /* Return value becomes exitcode. It's okay to not return at all */ static int do_set(char **argv) { char *dev = NULL; +#if ENABLE_FEATURE_IP_LINK_CAN + char *type = NULL; +#endif uint32_t mask = 0; uint32_t flags = 0; int qlen = -1; @@ -261,18 +521,24 @@ static int do_set(char **argv) "up\0""down\0""name\0""mtu\0""qlen\0""multicast\0" "arp\0""promisc\0""address\0""netns\0" "master\0""nomaster\0" +#if ENABLE_FEATURE_IP_LINK_CAN + "type\0" +#endif "dev\0" /* must be last */; enum { ARG_up = 0, ARG_down, ARG_name, ARG_mtu, ARG_qlen, ARG_multicast, ARG_arp, ARG_promisc, ARG_addr, ARG_netns, ARG_master, ARG_nomaster, +#if ENABLE_FEATURE_IP_LINK_CAN + ARG_type, +#endif ARG_dev }; - enum { PARM_on = 0, PARM_off }; smalluint key; while (*argv) { /* substring search ensures that e.g. "addr" and "address" * are both accepted */ key = index_in_substrings(keywords, *argv); + //printf("%s: key: %d, *argv: %s\n", __func__, key, *argv); if (key == ARG_up) { mask |= IFF_UP; flags |= IFF_UP; @@ -304,6 +570,13 @@ static int do_set(char **argv) } else if (key == ARG_netns) { NEXT_ARG(); netns = get_unsigned(*argv, "netns"); +#if ENABLE_FEATURE_IP_LINK_CAN + } else if (key == ARG_type) { + NEXT_ARG(); + type = *argv; + argv++; + break; +#endif } else if (key >= ARG_dev) { /* ^^^^^^ ">=" here results in "dev IFACE" treated as default */ if (key == ARG_dev) { @@ -311,6 +584,7 @@ static int do_set(char **argv) } if (dev) duparg2("dev", *argv); + dev = *argv; } else { /* "on|off" options */ @@ -496,6 +770,10 @@ static int do_set(char **argv) } if (mask) do_chflags(dev, flags, mask); +#if ENABLE_FEATURE_IP_LINK_CAN + if (type) + set_type(type, dev, argv); +#endif return 0; } @@ -531,10 +809,6 @@ static void vlan_parse_opt(char **argv, struct nlmsghdr *n, unsigned int size) PROTO_8021Q = 0, PROTO_8021AD, }; - enum { - PARM_on = 0, - PARM_off - }; int arg; uint16_t id, proto; struct ifla_vlan_flags flags = {}; @@ -610,10 +884,6 @@ static void vrf_parse_opt(char **argv, struct nlmsghdr *n, unsigned int size) addattr_l(n, size, IFLA_VRF_TABLE, &table, sizeof(table)); } -#ifndef NLMSG_TAIL -#define NLMSG_TAIL(nmsg) \ - ((struct rtattr *) (((void *) (nmsg)) + NLMSG_ALIGN((nmsg)->nlmsg_len))) -#endif /* Return value becomes exitcode. It's okay to not return at all */ static int do_add_or_delete(char **argv, const unsigned rtm) { From vda.linux at googlemail.com Mon Feb 26 15:27:53 2024 From: vda.linux at googlemail.com (Denys Vlasenko) Date: Mon, 26 Feb 2024 16:27:53 +0100 Subject: [git commit] ash: fix handling of single-quoted strings in pattern substitution Message-ID: <20240226152852.7944287B1A@busybox.osuosl.org> commit: https://git.busybox.net/busybox/commit/?id=c5a1be25ba6dd705382ce6c25d96a32f79974c04 branch: https://git.busybox.net/busybox/commit/?id=refs/heads/master function old new delta subevalvar 1576 1588 +12 Signed-off-by: Denys Vlasenko --- shell/ash.c | 5 +++++ shell/ash_test/ash-quoting/dollar_repl_bash2.right | 4 ++++ shell/ash_test/ash-quoting/dollar_repl_bash2.tests | 8 ++++++++ shell/hush_test/hush-quoting/dollar_repl_bash2.right | 4 ++++ shell/hush_test/hush-quoting/dollar_repl_bash2.tests | 8 ++++++++ 5 files changed, 29 insertions(+) diff --git a/shell/ash.c b/shell/ash.c index 771fc8bf9..4ca4c6c56 100644 --- a/shell/ash.c +++ b/shell/ash.c @@ -7073,6 +7073,11 @@ subevalvar(char *start, char *str, int strloc, repl = NULL; break; } + /* Skip over quoted 'str'. Example: ${var/'/'} - second / is not a separator */ + if ((unsigned char)*repl == CTLQUOTEMARK) { + while ((unsigned char)*++repl != CTLQUOTEMARK) + continue; + } if (*repl == '/') { *repl = '\0'; break; diff --git a/shell/ash_test/ash-quoting/dollar_repl_bash2.right b/shell/ash_test/ash-quoting/dollar_repl_bash2.right new file mode 100644 index 000000000..e3fcd5807 --- /dev/null +++ b/shell/ash_test/ash-quoting/dollar_repl_bash2.right @@ -0,0 +1,4 @@ +axxb +axxb +axxb +axxb diff --git a/shell/ash_test/ash-quoting/dollar_repl_bash2.tests b/shell/ash_test/ash-quoting/dollar_repl_bash2.tests new file mode 100755 index 000000000..45c7a10e2 --- /dev/null +++ b/shell/ash_test/ash-quoting/dollar_repl_bash2.tests @@ -0,0 +1,8 @@ +v="x/x" +# The second / is quoted, should not be treated as separator +echo a${v/'/'}b +# The second / is escaped, should not be treated as separator +echo a${v/\/}b + +echo "a${v/'/'}b" +echo "a${v/\/}b" diff --git a/shell/hush_test/hush-quoting/dollar_repl_bash2.right b/shell/hush_test/hush-quoting/dollar_repl_bash2.right new file mode 100644 index 000000000..e3fcd5807 --- /dev/null +++ b/shell/hush_test/hush-quoting/dollar_repl_bash2.right @@ -0,0 +1,4 @@ +axxb +axxb +axxb +axxb diff --git a/shell/hush_test/hush-quoting/dollar_repl_bash2.tests b/shell/hush_test/hush-quoting/dollar_repl_bash2.tests new file mode 100755 index 000000000..45c7a10e2 --- /dev/null +++ b/shell/hush_test/hush-quoting/dollar_repl_bash2.tests @@ -0,0 +1,8 @@ +v="x/x" +# The second / is quoted, should not be treated as separator +echo a${v/'/'}b +# The second / is escaped, should not be treated as separator +echo a${v/\/}b + +echo "a${v/'/'}b" +echo "a${v/\/}b" From bugzilla at busybox.net Thu Feb 29 10:19:11 2024 From: bugzilla at busybox.net (bugzilla at busybox.net) Date: Thu, 29 Feb 2024 10:19:11 +0000 Subject: [Bug 15001] netstat is vulnerable to escape sequence injection (busybox) In-Reply-To: References: Message-ID: https://bugs.busybox.net/show_bug.cgi?id=15001 Alexander Kanavin changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |alex.kanavin at gmail.com --- Comment #2 from Alexander Kanavin --- Created attachment 9718 --> https://bugs.busybox.net/attachment.cgi?id=9718&action=edit patch 1/2 -- You are receiving this mail because: You are on the CC list for the bug. From bugzilla at busybox.net Thu Feb 29 10:19:34 2024 From: bugzilla at busybox.net (bugzilla at busybox.net) Date: Thu, 29 Feb 2024 10:19:34 +0000 Subject: [Bug 15001] netstat is vulnerable to escape sequence injection (busybox) In-Reply-To: References: Message-ID: https://bugs.busybox.net/show_bug.cgi?id=15001 --- Comment #3 from Alexander Kanavin --- Created attachment 9721 --> https://bugs.busybox.net/attachment.cgi?id=9721&action=edit patch 2/2 -- You are receiving this mail because: You are on the CC list for the bug. From bugzilla at busybox.net Thu Feb 29 10:20:47 2024 From: bugzilla at busybox.net (bugzilla at busybox.net) Date: Thu, 29 Feb 2024 10:20:47 +0000 Subject: [Bug 15001] netstat is vulnerable to escape sequence injection (busybox) In-Reply-To: References: Message-ID: https://bugs.busybox.net/show_bug.cgi?id=15001 --- Comment #4 from Alexander Kanavin --- I have attached the two patches originating from Alpine and rebased on current busybox master. I'm not sure if they're correct, so reluctant to submit them formally. Please consider and adjust as needed. -- You are receiving this mail because: You are on the CC list for the bug.