From bugzilla at busybox.net Wed Mar 1 22:11:03 2023
From: bugzilla at busybox.net (bugzilla at busybox.net)
Date: Wed, 01 Mar 2023 22:11:03 +0000
Subject: [Bug 15236] [1.36] SIGILL on accessing sha256 on some CPUs
In-Reply-To:
References:
Message-ID:
https://bugs.busybox.net/show_bug.cgi?id=15236
--- Comment #1 from Tianon Gravi ---
There has been some related discussion on the mailing list since this was
opened, FWIW:
- http://lists.busybox.net/pipermail/busybox/2023-January/090113.html
- http://lists.busybox.net/pipermail/busybox/2023-March/090188.html
- http://lists.busybox.net/pipermail/busybox/2023-March/090190.html
- http://lists.busybox.net/pipermail/busybox/2023-March/090192.html
--
You are receiving this mail because:
You are on the CC list for the bug.
From bugzilla at busybox.net Sat Mar 4 14:38:42 2023
From: bugzilla at busybox.net (bugzilla at busybox.net)
Date: Sat, 04 Mar 2023 14:38:42 +0000
Subject: [Bug 15236] [1.36] SIGILL on accessing sha256 on some CPUs
In-Reply-To:
References:
Message-ID:
https://bugs.busybox.net/show_bug.cgi?id=15236
--- Comment #2 from Ben ---
Created attachment 9521
--> https://bugs.busybox.net/attachment.cgi?id=9521&action=edit
patch which changes the sha extensions detection
--
You are receiving this mail because:
You are on the CC list for the bug.
From bugzilla at busybox.net Sat Mar 4 14:40:10 2023
From: bugzilla at busybox.net (bugzilla at busybox.net)
Date: Sat, 04 Mar 2023 14:40:10 +0000
Subject: [Bug 15236] [1.36] SIGILL on accessing sha256 on some CPUs
In-Reply-To:
References:
Message-ID:
https://bugs.busybox.net/show_bug.cgi?id=15236
--- Comment #3 from Ben ---
Intel has a documented C function (with inline assembly) to check for the SHA
processor extensions:
... in their CheckForIntelShaExtensions function after the CPUID call, the
relevant bit is:
> // Intel? SHA Extensions feature bit is EBX[29]
> return ((b >> 29) & 1);
BusyBox v1.36.0 seems to perform this check differently:
shaNI = ((ebx >> 29) << 1) - 1;
if (shaNI > 0) ...
I was able to make the sha256sum function work on 8272CL by applying the
attached patch.
--
You are receiving this mail because:
You are on the CC list for the bug.
From bugzilla at busybox.net Mon Mar 6 02:45:55 2023
From: bugzilla at busybox.net (bugzilla at busybox.net)
Date: Mon, 06 Mar 2023 02:45:55 +0000
Subject: [Bug 15371] New: env in shebang won't accept more than 1 parameter
Message-ID:
https://bugs.busybox.net/show_bug.cgi?id=15371
Bug ID: 15371
Summary: env in shebang won't accept more than 1 parameter
Product: Busybox
Version: unspecified
Hardware: All
OS: Linux
Status: NEW
Severity: enhancement
Priority: P5
Component: Other
Assignee: unassigned at busybox.net
Reporter: m95d+git at psihoexpert.ro
CC: busybox-cvs at busybox.net
Target Milestone: ---
Busybox v1.36.0
When script interpreter path is unknown, it is common to use env as a
"preloader" in the shebang:
#!/bin/env -S
Busybox env does not support -S parameter. Without -S, tries to execute
[interpreter and it's parameters] as a single filename.
Example:
Script starts with "#!/bin/env awk -f":
execve("/usr/sbin/awk -f", ["awk -f", "/bin/ipcalc.sh"], 0xbe806d84 /* 16 vars
*/) = -1 ENOENT (No such file or directory)
execve("/usr/bin/awk -f", ["awk -f", "/bin/ipcalc.sh"], 0xbe806d84 /* 16 vars
*/) = -1 ENOENT (No such file or directory)
execve("/sbin/awk -f", ["awk -f", "/bin/ipcalc.sh"], 0xbe806d84 /* 16 vars */)
= -1 ENOENT (No such file or directory)
execve("/bin/awk -f", ["awk -f", "/bin/ipcalc.sh"], 0xbe806d84 /* 16 vars */) =
-1 ENOENT (No such file or directory)
Please add -S parameter to env.
Thank you.
--
You are receiving this mail because:
You are on the CC list for the bug.
From bugzilla at busybox.net Thu Mar 9 21:58:01 2023
From: bugzilla at busybox.net (bugzilla at busybox.net)
Date: Thu, 09 Mar 2023 21:58:01 +0000
Subject: [Bug 13991] New: httpd doesn't serve index.php with 1.32
Message-ID:
https://bugs.busybox.net/show_bug.cgi?id=13991
Bug ID: 13991
Summary: httpd doesn't serve index.php with 1.32
Product: Busybox
Version: 1.32.x
Hardware: All
OS: Linux
Status: NEW
Severity: normal
Priority: P5
Component: Networking
Assignee: unassigned at busybox.net
Reporter: hi at konstantin-schauwecker.de
CC: busybox-cvs at busybox.net
Target Milestone: ---
I have upgraded a system that was previously running 1.29.2 to busybox 1.32.0.
The system is running httpd and the index file name is set to index.php, with
the php interpreter configured for all *.php file.
Since the update, it's not possible to access any php files without explicitly
writing "index.php" in the URL. Example:
http://my-ip/index.php works on both systems
http://my-ip/ only works on 1.29.2
I get a 404 error and the following log:
[::ffff:192.168.10.5]:60708: can't execute '': No such file or directory
[::ffff:192.168.10.5]:60708: response:404
My httpd.conf file is:
=============
*.php:/usr/bin/aarch64-linux-php-cgi
I:index.php
h:/var/www
# Mime types
.pdf:application/pdf
.yaml:text/yaml
.js:text/javascript
--- Comment #1 from KS ---
I found a work-around for this issue. I created a cgi-bin/index.cgi file with
the following content:
------
#!/bin/bash
php_name="/var/www/$REQUEST_URI/index.php"
if [[ -f $php_name ]]; then
export SCRIPT_FILENAME=$php_name
cd `dirname $php_name`
pwd
aarch64-linux-php-cgi
else
exit 1
fi
--- Comment #2 from Vex Mage ---
I'm having this problem too on version 1.34.1, although I'm using ph7 not php.
Here's my script I wrote to workaround the issue. It, hopefully, preserves any
query string and redirects sub directories. I'm certain there are bugs.
/etc/httpd.conf
H:/var/www
I:index.php
A:*
*.php:/usr/bin/ph7
/var/www/cgi-bin/index.cgi:
#!/bin/sh
REDIRECT_URI=`echo ${REQUEST_URI} | awk -F? '{ print $1 }'`
REDIRECT_QUERY=`echo ${REQUEST_URI} | awk -F? '{ print $2 }'`
if [ -e $REDIRECT_QUERY ] ; then
REDIRECT_PATH=${REDIRECT_URI}index.php
else
REDIRECT_PATH=${REDIRECT_URI}index.php?${REDIRECT_QUERY}
fi
echo "Status: 307 Temporary Redirect"
echo "Location: ${REDIRECT_PATH}"
echo ""
--
You are receiving this mail because:
You are on the CC list for the bug.
From bugzilla at busybox.net Sun Mar 12 12:58:08 2023
From: bugzilla at busybox.net (bugzilla at busybox.net)
Date: Sun, 12 Mar 2023 12:58:08 +0000
Subject: [Bug 15386] New: ping -w doesn't respect timeout if -c is specified
Message-ID:
https://bugs.busybox.net/show_bug.cgi?id=15386
Bug ID: 15386
Summary: ping -w doesn't respect timeout if -c is specified
Product: Busybox
Version: 1.35.x
Hardware: All
OS: Linux
Status: NEW
Severity: minor
Priority: P5
Component: Networking
Assignee: unassigned at busybox.net
Reporter: gschintgen at hambier.lu
CC: busybox-cvs at busybox.net
Target Milestone: ---
On Alpine 3.17 with busybox 1.35 I noticed the following:
nodered:~# time ping -w 1 192.168.12.34
PING 192.168.12.34 (192.168.12.34): 56 data bytes
--- 192.168.12.34 ping statistics ---
1 packets transmitted, 0 packets received, 100% packet loss
Command exited with non-zero status 1
real 0m 1.00s
user 0m 0.00s
sys 0m 0.00s
nodered:~# time ping -w 1 -c 1 192.168.12.34
PING 192.168.12.34 (192.168.12.34): 56 data bytes
--- 192.168.12.34 ping statistics ---
1 packets transmitted, 0 packets received, 100% packet loss
Command exited with non-zero status 1
real 0m 10.00s
user 0m 0.00s
sys 0m 0.00s
In other words, if a count is specified, ping no longer follows its documented
behaviour which only mentions *earlier* exiting.
-w SEC Seconds until ping exits (default:infinite)
(can exit earlier with -c CNT)
For comparison, here is the output for ping from iputils 20211215 (Ubuntu
22.04):
$ time ping -w 1 192.168.12.34
PING 192.168.12.34 (192.168.12.34) 56(84) bytes of data.
--- 192.168.12.34 ping statistics ---
1 packets transmitted, 0 received, 100% packet loss, time 0ms
real 0m1.007s
user 0m0.006s
sys 0m0.001s
$ time ping -w 1 -c 1 192.168.12.34
PING 192.168.12.34 (192.168.12.34) 56(84) bytes of data.
--- 192.168.12.34 ping statistics ---
1 packets transmitted, 0 received, 100% packet loss, time 0ms
real 0m1.006s
user 0m0.001s
sys 0m0.006s
I can't say with certainty which behaviour is correct or incorrect (e.g. when
compared to POSIX or some other reference Unix specification), so please
indulge me if this is not an actual bug on busybox's side.
(My use case is using a nodered ping node with configurable timeout. It didn't
work quite right on my nodered instance and I tracked it down to this
difference.)
--
You are receiving this mail because:
You are on the CC list for the bug.
From bugzilla at busybox.net Tue Mar 14 11:27:59 2023
From: bugzilla at busybox.net (bugzilla at busybox.net)
Date: Tue, 14 Mar 2023 11:27:59 +0000
Subject: [Bug 15391] New: Ipv6 ping is not taking correct ttl.
Message-ID:
https://bugs.busybox.net/show_bug.cgi?id=15391
Bug ID: 15391
Summary: Ipv6 ping is not taking correct ttl.
Product: Busybox
Version: 1.31.x
Hardware: All
OS: Linux
Status: NEW
Severity: major
Priority: P5
Component: Networking
Assignee: unassigned at busybox.net
Reporter: 1nagarjun1 at gmail.com
CC: busybox-cvs at busybox.net
Target Milestone: ---
ping -I eth2 -t 1 2001:10:2:2::2
PING 2001:10:2:2::2 (2001:10:2:2::2): 56 data bytes
64 bytes from 2001:10:2:2::2: seq=0 ttl=64 time=0.133 ms
64 bytes from 2001:10:2:2::2: seq=1 ttl=64 time=0.088 ms
^C
--- 2001:10:2:2::2 ping statistics ---
2 packets transmitted, 2 packets received, 0% packet loss
round-trip min/avg/max = 0.088/0.110/0.133 ms
--
You are receiving this mail because:
You are on the CC list for the bug.
From bugzilla at busybox.net Tue Mar 21 17:06:05 2023
From: bugzilla at busybox.net (bugzilla at busybox.net)
Date: Tue, 21 Mar 2023 17:06:05 +0000
Subject: [Bug 15466] New: 'realpath -- /tmp' non-compliant with upcoming POSIX
Message-ID:
https://bugs.busybox.net/show_bug.cgi?id=15466
Bug ID: 15466
Summary: 'realpath -- /tmp' non-compliant with upcoming POSIX
Product: Busybox
Version: 1.35.x
Hardware: All
OS: Linux
Status: NEW
Severity: normal
Priority: P5
Component: Standard Compliance
Assignee: unassigned at busybox.net
Reporter: eblake at redhat.com
CC: busybox-cvs at busybox.net
Target Milestone: ---
POSIX will be standardizing realpath in Issue 8:
https://www.austingroupbugs.net/view.php?id=1457
As such, the standard requirements that all utilities not explicitly excluded
(basically, echo is one of the few explicit exceptions) MUST accept -- as
end-of-options, even when the standard does not require any standardized
options. Once Issue 8 is out,
realpath /tmp
realpath -- /tmp
must have identical behavior. Busybox 1.35 (I tested the pre-built version
available on Fedora 37) fails this:
$ busybox realpath -- /tmp
realpath: --: No such file or directory
/tmp
--
You are receiving this mail because:
You are on the CC list for the bug.
From bugzilla at busybox.net Wed Mar 22 06:53:11 2023
From: bugzilla at busybox.net (bugzilla at busybox.net)
Date: Wed, 22 Mar 2023 06:53:11 +0000
Subject: [Bug 15471] New: tar --exclude did not consider --strip-components
Message-ID:
https://bugs.busybox.net/show_bug.cgi?id=15471
Bug ID: 15471
Summary: tar --exclude did not consider --strip-components
Product: Busybox
Version: unspecified
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P5
Component: Standard Compliance
Assignee: unassigned at busybox.net
Reporter: kkocdko at gmail.com
CC: busybox-cvs at busybox.net
Target Milestone: ---
# tar --exclude did not consider --strip-components
While gnu tar extract a tar file with content `./dir1/dir2/file`, using
`--strip-components 1 --exclude dir2` switches, it will first strip `dir1`,
then match and exclude `dir2`.
However what busybox's tar implementation do is first to match and exclude,
then do `--strip-components 1`.
The test.sh here:
```sh
# tested on debian:11 livecd and fedora:37 livecd
busybox
# clear old files
rm -rf bb-test
# prepair for testing
mkdir -p bb-test/dir1/dir2
cd bb-test
echo file3-content > dir1/dir2/file3
tar -cf a.tar ./dir1
mkdir out-coreut-1 out-busybo-1 out-coreut-2 out-busybo-2
# let's try!
tar -xf a.tar -C out-coreut-1 --strip-components 1 --exclude dir1
busybox tar -xf a.tar -C out-busybo-1 --strip-components 1 --exclude dir1
tar -xf a.tar -C out-coreut-2 --strip-components 1 --exclude dir2
busybox tar -xf a.tar -C out-busybo-2 --strip-components 1 --exclude dir2
# see difference
echo "" && tree out-coreut-1
echo "" && tree out-busybo-1
echo "" && tree out-coreut-2
echo "" && tree out-busybo-2
cd ..
```
And the output on my machine:
```
[kkocdko at klf busybox-report]$ ./test.sh
BusyBox v1.36.0 (2023-01-10 00:00:00 UTC) multi-call binary.
...
out-coreut-1
0 directories, 0 files
out-busybo-1
??? dir1
??? dir2
??? file3
3 directories, 1 file
out-coreut-2
??? dir1
2 directories, 0 files
out-busybo-2
??? dir1
??? dir2
??? file3
3 directories, 1 file
[kkocdko at klf busybox-report]$
```
--
You are receiving this mail because:
You are on the CC list for the bug.
From bugzilla at busybox.net Wed Mar 22 07:14:40 2023
From: bugzilla at busybox.net (bugzilla at busybox.net)
Date: Wed, 22 Mar 2023 07:14:40 +0000
Subject: [Bug 15471] tar --exclude did not consider --strip-components
In-Reply-To:
References:
Message-ID:
https://bugs.busybox.net/show_bug.cgi?id=15471
kkocdko changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |INVALID
Status|NEW |RESOLVED
--- Comment #1 from kkocdko ---
I'm sorry, the test script is broken.
--
You are receiving this mail because:
You are on the CC list for the bug.
From bugzilla at busybox.net Wed Mar 22 13:13:14 2023
From: bugzilla at busybox.net (bugzilla at busybox.net)
Date: Wed, 22 Mar 2023 13:13:14 +0000
Subject: [Bug 15466] 'realpath -- /tmp' non-compliant with upcoming POSIX
In-Reply-To:
References:
Message-ID:
https://bugs.busybox.net/show_bug.cgi?id=15466
--- Comment #1 from Eric Blake ---
Similarly, POSIX still requires 'readlink -- /foo' and 'readlink /foo' to
behave identically. This is implemented correctly when FEATURE_READLINK_FOLLOW
is enabled (as a side effect of accepting the POSIX-mandated -n), but fails
when the feature is disabled (that branch of the code should probably use
single_argv(), similarly to how coreutils/dirname.c was patched).
--
You are receiving this mail because:
You are on the CC list for the bug.
From bugzilla at busybox.net Wed Mar 22 15:39:17 2023
From: bugzilla at busybox.net (bugzilla at busybox.net)
Date: Wed, 22 Mar 2023 15:39:17 +0000
Subject: [Bug 15476] New: cd allows odd .... directory
Message-ID:
https://bugs.busybox.net/show_bug.cgi?id=15476
Bug ID: 15476
Summary: cd allows odd .... directory
Product: Busybox
Version: unspecified
Hardware: PC
OS: Linux
Status: NEW
Severity: minor
Priority: P5
Component: Other
Assignee: unassigned at busybox.net
Reporter: mstam at ripe.net
CC: busybox-cvs at busybox.net
Target Milestone: ---
Created attachment 9556
--> https://bugs.busybox.net/attachment.cgi?id=9556&action=edit
busybox .config
Hi guys,
I mistyped a directory name by working on an OpenWRT box running an older
version of busybox executing 'cd .../..' instead of 'cd ../..'. The command
returns exit code 0, but doesn't seem to do anything.
I did some further investigation, executing 'cd
................................/..' and still this is allowed. 'cd ../...'
returns the expected "can't cd to" error, however 'cd ../........./..' again
executes (and goes only one directory up).
Any thoughts?
Built on a PC, but also observed on 2 different AARCH64 systems, each one
running older versions of OpenWRT (2018 and 2020 from memory). This suggests
this has been around for a while.
Config is mostly default, I ran:
git clone https://git.busybox.net/busybox.git
cd busybox
git checkout master
make defconfig
make menuconfig <<<<< disable seedrng, it cannot find sys/random.h
make
busybox ash
cd ....../.. <<<<<<< or any of the other mentioned commands.
Hope it helps.
Cheers,
Michel
--
You are receiving this mail because:
You are on the CC list for the bug.
From bugzilla at busybox.net Wed Mar 22 16:01:03 2023
From: bugzilla at busybox.net (bugzilla at busybox.net)
Date: Wed, 22 Mar 2023 16:01:03 +0000
Subject: [Bug 15481] New: /bin/sh does not work when invoked with argv[0]
different from "sh"
Message-ID:
https://bugs.busybox.net/show_bug.cgi?id=15481
Bug ID: 15481
Summary: /bin/sh does not work when invoked with argv[0]
different from "sh"
Product: Busybox
Version: 1.35.x
Hardware: All
OS: Linux
Status: NEW
Severity: normal
Priority: P5
Component: Standard Compliance
Assignee: unassigned at busybox.net
Reporter: lersek at redhat.com
CC: busybox-cvs at busybox.net
Target Milestone: ---
The POSIX specification (Issue 7, TC2 applied) explains at
https://pubs.opengroup.org/onlinepubs/9699919799/functions/execvp.html
that, if
execvp(file, { argv[0], argv[1], ..., NULL })
were to fail with -1/ENOEXEC, then execvp() must retry "as if" with
execv(, { argv[0], file, argv[1], ..., NULL })
In other words, if direct execution of "file" failed because "file" "has the
appropriate access permission but has an unrecognized format", then execvp() is
required to try executing "file" as a shell script. For that, is
left unspecified by POSIX, but the arguments of the shell are specified:
- Argv[0] remains the same. That is, what we wanted "file" to know itself as,
is what we now want *the shell executable* to know itself as.
- argv[1] becomes "file" -- this is the script that the shell is supposed to
run.
- argv[2] and onwards become positional parameters $1, $2, ... for the shell
script.
On a system where "/bin/sh" is provided by busybox (that is, "/bin/sh" is a
symlink to "/bin/busybox"), any execvp() implementation that uses "/bin/sh" for
will break the required ENOEXEC behavior, in the general case.
That's because busybox will not recognize from argv[0] (= file) that it's
supposed to behave as the shell.
The simplest way to demonstrate the bug is this:
bash$ ( exec -a foobar /bin/sh <<< "echo hello" )
foobar: applet not found
(Unfortunately, the bug cannot be demonstrated via widely used C libraries,
such as glibc and musl. The reason is that *both* glibc and musl have bugs that
*hide* the busybox bug.
- In musl, the ENOEXEC path is not handled at all, so musl doesn't even try to
invoke the shell.
- In glibc, the POSIX-mandated argument list for the shell is not implemented
properly. Again, the argument list is supposed to be
execv(, { argv[0], file, argv[1], ..., NULL })
but glibc does
execv(, { , file, argv[1], ..., NULL })
which is precisely what masks this busybox bug.
Refer to _PATH_BSHELL in historical glibc commit 6a032d815819, and in today's
glibc file "posix/execvpe.c".)
The ask here is to provide a standalone /bin/sh binary that is not sensitive to
what argv[0] it is invoked under. Thanks.
--
You are receiving this mail because:
You are on the CC list for the bug.
From bugzilla at busybox.net Wed Mar 22 20:03:45 2023
From: bugzilla at busybox.net (bugzilla at busybox.net)
Date: Wed, 22 Mar 2023 20:03:45 +0000
Subject: [Bug 15481] /bin/sh does not work when invoked with argv[0]
different from "sh"
In-Reply-To:
References:
Message-ID:
https://bugs.busybox.net/show_bug.cgi?id=15481
--- Comment #1 from Eric Blake ---
In parallel, I've opened https://www.austingroupbugs.net/view.php?id=1645;
maybe POSIX will be relaxed to allow libc implementations to fall back to
execl("/bin/sh", "sh", "-c", ". quoted_file", argv[0], argv[1], ..., NULL) or
execl("/bin/sh", "sh", "-c", "exec -a \"$0\" quoted_file \"$@\"", argv[0],
argv[1], ..., NULL), at which point busybox can still depend on argv[0] ending
in "sh" while passing the correct $0 to the shell script. Let's see what the
libc and POSIX folks say...
--
You are receiving this mail because:
You are on the CC list for the bug.
From bugzilla at busybox.net Thu Mar 23 14:07:48 2023
From: bugzilla at busybox.net (bugzilla at busybox.net)
Date: Thu, 23 Mar 2023 14:07:48 +0000
Subject: [Bug 15466] 'realpath -- /tmp' non-compliant with upcoming POSIX
In-Reply-To:
References:
Message-ID:
https://bugs.busybox.net/show_bug.cgi?id=15466
--- Comment #2 from Eric Blake ---
Created attachment 9561
--> https://bugs.busybox.net/attachment.cgi?id=9561&action=edit
readlink: Support --, -n always
Ugh - unlike many open-source projects, your mailing list does not allow
moderated posting from non-subscribers. So while I wait for my subscription
request to be processed, I'm attaching a partial proposed patch for readlink.
Originally, I thought to do a one-liner to use single_argv(); then realized
that it was easier to blindly support -n in all configurations since POSIX will
require -n support. I'm still trying to learn whether POSIX or GNU Coreutils
will prevail on whether readlink should be silent or verbose by default.
--
You are receiving this mail because:
You are on the CC list for the bug.
From vda.linux at googlemail.com Tue Mar 28 15:42:00 2023
From: vda.linux at googlemail.com (Denys Vlasenko)
Date: Tue, 28 Mar 2023 17:42:00 +0200
Subject: [git commit branch/1_36_stable] unzip: clear SUID/GID bits,
implement -K to not clear them
Message-ID: <20230328154208.4B6C98353E@busybox.osuosl.org>
commit: https://git.busybox.net/busybox/commit/?id=c0bb90e2fe56b74af34047d446e7758172bbf4b7
branch: https://git.busybox.net/busybox/commit/?id=refs/heads/1_36_stable
function old new delta
unzip_main 2656 2715 +59
packed_usage 34517 34552 +35
.rodata 105250 105251 +1
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/0 up/down: 95/0) Total: 95 bytes
Signed-off-by: Denys Vlasenko
---
archival/unzip.c | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/archival/unzip.c b/archival/unzip.c
index b27dd2187..691a2d81b 100644
--- a/archival/unzip.c
+++ b/archival/unzip.c
@@ -56,7 +56,7 @@
//kbuild:lib-$(CONFIG_UNZIP) += unzip.o
//usage:#define unzip_trivial_usage
-//usage: "[-lnojpq] FILE[.zip] [FILE]... [-x FILE]... [-d DIR]"
+//usage: "[-lnojpqK] FILE[.zip] [FILE]... [-x FILE]... [-d DIR]"
//usage:#define unzip_full_usage "\n\n"
//usage: "Extract FILEs from ZIP archive\n"
//usage: "\n -l List contents (with -q for short form)"
@@ -66,6 +66,7 @@
//usage: "\n -p Write to stdout"
//usage: "\n -t Test"
//usage: "\n -q Quiet"
+//usage: "\n -K Do not clear SUID bit"
//usage: "\n -x FILE Exclude FILEs"
//usage: "\n -d DIR Extract into DIR"
@@ -494,6 +495,7 @@ int unzip_main(int argc, char **argv)
OPT_l = (1 << 0),
OPT_x = (1 << 1),
OPT_j = (1 << 2),
+ OPT_K = (1 << 3),
};
unsigned opts;
smallint quiet = 0;
@@ -559,7 +561,7 @@ int unzip_main(int argc, char **argv)
opts = 0;
/* '-' makes getopt return 1 for non-options */
- while ((i = getopt(argc, argv, "-d:lnotpqxjv")) != -1) {
+ while ((i = getopt(argc, argv, "-d:lnotpqxjvK")) != -1) {
switch (i) {
case 'd': /* Extract to base directory */
base_dir = optarg;
@@ -602,6 +604,10 @@ int unzip_main(int argc, char **argv)
opts |= OPT_j;
break;
+ case 'K':
+ opts |= OPT_K;
+ break;
+
case 1:
if (!src_fn) {
/* The zip file */
@@ -819,7 +825,10 @@ int unzip_main(int argc, char **argv)
# endif
if ((cdf.fmt.version_made_by >> 8) == 3) {
/* This archive is created on Unix */
- dir_mode = file_mode = (cdf.fmt.external_attributes >> 16);
+ file_mode = (cdf.fmt.external_attributes >> 16);
+ if (!(opts & OPT_K))
+ file_mode &= ~(mode_t)(S_ISUID | S_ISGID);
+ dir_mode = file_mode;
}
}
#endif
From vda.linux at googlemail.com Tue Mar 28 16:08:02 2023
From: vda.linux at googlemail.com (Denys Vlasenko)
Date: Tue, 28 Mar 2023 18:08:02 +0200
Subject: [git commit] find: implement -ok
Message-ID: <20230328161325.6448A835CE@busybox.osuosl.org>
commit: https://git.busybox.net/busybox/commit/?id=d8a33603801476dd870ea66c36cf7c64d852d674
branch: https://git.busybox.net/busybox/commit/?id=refs/heads/master
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/find.html
-ok utility_name [argument??...]??;
The -ok primary shall be equivalent to -exec, except that the use
of a to punctuate the end of the primary expression
need not be supported, and find shall request affirmation of the
invocation of utility_name using the current file as an argument
by writing to standard error as described in the STDERR section. If
the response on standard input is affirmative, the utility shall be
invoked. Otherwise, the command shall not be invoked and the value
of the -ok operand shall be false.
function old new delta
do_exec 438 517 +79
parse_params 1833 1845 +12
static.params 288 292 +4
.rodata 100771 100775 +4
packed_usage 34543 34541 -2
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 4/1 up/down: 99/-2) Total: 97 bytes
Signed-off-by: David Leonard
Signed-off-by: Denys Vlasenko
---
findutils/find.c | 39 ++++++++++++++++++++++++++++++++++++---
testsuite/find.tests | 6 ++++++
2 files changed, 42 insertions(+), 3 deletions(-)
diff --git a/findutils/find.c b/findutils/find.c
index bb6ad31e5..136ca0d21 100644
--- a/findutils/find.c
+++ b/findutils/find.c
@@ -180,6 +180,13 @@
//config: Without this option, -exec + is a synonym for -exec ;
//config: (IOW: it works correctly, but without expected speedup)
//config:
+//config:config FEATURE_FIND_EXEC_OK
+//config: bool "Enable -ok: execute confirmed commands"
+//config: default y
+//config: depends on FEATURE_FIND_EXEC
+//config: help
+//config: Support the 'find -ok' option which prompts before executing.
+//config:
//config:config FEATURE_FIND_USER
//config: bool "Enable -user: username/uid matching"
//config: default y
@@ -395,6 +402,9 @@
//usage: IF_FEATURE_FIND_EXEC_PLUS(
//usage: "\n -exec CMD ARG + Run CMD with {} replaced by list of file names"
//usage: )
+//usage: IF_FEATURE_FIND_EXEC_OK(
+//usage: "\n -ok CMD ARG ; Prompt and run CMD with {} replaced"
+//usage: )
//usage: IF_FEATURE_FIND_DELETE(
//usage: "\n -delete Delete current file/directory. Turns on -depth option"
//usage: )
@@ -467,6 +477,9 @@ IF_FEATURE_FIND_EXEC( ACTS(exec,
char **exec_argv; /* -exec ARGS */
unsigned *subst_count;
int exec_argc; /* count of ARGS */
+ IF_FEATURE_FIND_EXEC_OK(
+ int ok; /* -ok */
+ )
IF_FEATURE_FIND_EXEC_PLUS(
/*
* filelist is NULL if "exec ;"
@@ -802,10 +815,24 @@ static int do_exec(action_exec *ap, const char *fileName)
}
# endif
+# if ENABLE_FEATURE_FIND_EXEC_OK
+ if (ap->ok) {
+ for (i = 0; argv[i]; i++)
+ fprintf(stderr, "%s ", argv[i]);
+ fprintf(stderr, "?");
+ if (!bb_ask_y_confirmation()) {
+ rc = 1; /* "false" */
+ goto not_ok;
+ }
+ }
+# endif
rc = spawn_and_wait(argv);
if (rc < 0)
bb_simple_perror_msg(argv[0]);
+# if ENABLE_FEATURE_FIND_EXEC_OK
+ not_ok:
+# endif
i = 0;
while (argv[i])
free(argv[i++]);
@@ -1120,6 +1147,7 @@ static action*** parse_params(char **argv)
IF_FEATURE_FIND_DELETE( PARM_delete ,)
IF_FEATURE_FIND_EMPTY( PARM_empty ,)
IF_FEATURE_FIND_EXEC( PARM_exec ,)
+ IF_FEATURE_FIND_EXEC_OK(PARM_ok ,)
IF_FEATURE_FIND_EXECUTABLE(PARM_executable,)
IF_FEATURE_FIND_PAREN( PARM_char_brace,)
/* All options/actions starting from here require argument */
@@ -1171,6 +1199,7 @@ static action*** parse_params(char **argv)
IF_FEATURE_FIND_DELETE( "-delete\0" )
IF_FEATURE_FIND_EMPTY( "-empty\0" )
IF_FEATURE_FIND_EXEC( "-exec\0" )
+ IF_FEATURE_FIND_EXEC_OK("-ok\0" )
IF_FEATURE_FIND_EXECUTABLE("-executable\0")
IF_FEATURE_FIND_PAREN( "(\0" )
/* All options/actions starting from here require argument */
@@ -1351,23 +1380,27 @@ static action*** parse_params(char **argv)
}
#endif
#if ENABLE_FEATURE_FIND_EXEC
- else if (parm == PARM_exec) {
+ else if (parm == PARM_exec IF_FEATURE_FIND_EXEC_OK(|| parm == PARM_ok)) {
int i;
action_exec *ap;
IF_FEATURE_FIND_EXEC_PLUS(int all_subst = 0;)
dbg("%d", __LINE__);
G.need_print = 0;
ap = ALLOC_ACTION(exec);
+ IF_FEATURE_FIND_EXEC_OK(ap->ok = (parm == PARM_ok);)
ap->exec_argv = ++argv; /* first arg after -exec */
/*ap->exec_argc = 0; - ALLOC_ACTION did it */
while (1) {
if (!*argv) /* did not see ';' or '+' until end */
- bb_error_msg_and_die(bb_msg_requires_arg, "-exec");
+ bb_error_msg_and_die(bb_msg_requires_arg, arg);
// find -exec echo Foo ">{}<" ";"
// executes "echo Foo >FILENAME<",
// find -exec echo Foo ">{}<" "+"
// executes "echo Foo FILENAME1 FILENAME2 FILENAME3...".
- if ((argv[0][0] == ';' || argv[0][0] == '+')
+ if ((argv[0][0] == ';'
+ || (argv[0][0] == '+' IF_FEATURE_FIND_EXEC_OK(&& parm != PARM_ok))
+ /* -ok CMD + syntax is not accepted, only with ';' */
+ )
&& argv[0][1] == '\0'
) {
# if ENABLE_FEATURE_FIND_EXEC_PLUS
diff --git a/testsuite/find.tests b/testsuite/find.tests
index 138236c81..d763ca6f2 100755
--- a/testsuite/find.tests
+++ b/testsuite/find.tests
@@ -28,6 +28,12 @@ testing "find -exec exitcode 2" \
"0\n" \
"" ""
SKIP=
+optional FEATURE_FIND_EXEC_OK
+testing "find -ok" \
+ "cd find.tempdir && find testfile -ok true {} ';' 2>&1; echo \$?" \
+ "true testfile ?0\n" \
+ "" "y"
+SKIP=
# Surprisingly, "-exec false ;" results in exitcode 0! "-exec false +" is different!!!
optional FEATURE_FIND_EXEC
testing "find -exec exitcode 3" \
From vda.linux at googlemail.com Tue Mar 28 16:56:08 2023
From: vda.linux at googlemail.com (Denys Vlasenko)
Date: Tue, 28 Mar 2023 18:56:08 +0200
Subject: [git commit] httpd: do not mangle cgi-bin/SCRIPT/params URLs
Message-ID: <20230328165919.6871C835D3@busybox.osuosl.org>
commit: https://git.busybox.net/busybox/commit/?id=3253d7fe0097ff15797ee4918e927b0c9d6863a9
branch: https://git.busybox.net/busybox/commit/?id=refs/heads/master
If cgi-bin/ prefix is seen, do not test the rest for existence,
whether it's a dir, and such.
function old new delta
handle_incoming_and_exit 2200 2212 +12
Reported here:
https://lists.zx2c4.com/pipermail/cgit/2023-March/004825.html
Signed-off-by: Denys Vlasenko
---
networking/httpd.c | 74 ++++++++++++++++++++++++++++--------------------------
1 file changed, 38 insertions(+), 36 deletions(-)
diff --git a/networking/httpd.c b/networking/httpd.c
index ffc58e10b..252ad6c2d 100644
--- a/networking/httpd.c
+++ b/networking/httpd.c
@@ -2405,50 +2405,52 @@ static void handle_incoming_and_exit(const len_and_sockaddr *fromAddr)
send_headers_and_exit(HTTP_FORBIDDEN);
}
cgi_type = CGI_NORMAL;
- }
+ } /* why "else": do not check "cgi-bin/SCRIPT/something" for cases below: */
+ else
#endif
-
- if (urlp[-1] == '/') {
- /* When index_page string is appended to / URL, it overwrites
- * the query string. If we fall back to call /cgi-bin/index.cgi,
- * query string would be lost and not available to the CGI.
- * Work around it by making a deep copy.
- */
- if (ENABLE_FEATURE_HTTPD_CGI)
- g_query = xstrdup(g_query); /* ok for NULL too */
- strcpy(urlp, index_page);
- }
- if (stat(tptr, &sb) == 0) {
- /* If URL is a directory with no slash, set up
- * "HTTP/1.1 302 Found" "Location: /dir/" reply */
- if (urlp[-1] != '/' && S_ISDIR(sb.st_mode)) {
- found_moved_temporarily = urlcopy;
- } else {
+ {
+ if (urlp[-1] == '/') {
+ /* When index_page string is appended to / URL, it overwrites
+ * the query string. If we fall back to call /cgi-bin/index.cgi,
+ * query string would be lost and not available to the CGI.
+ * Work around it by making a deep copy.
+ */
+ if (ENABLE_FEATURE_HTTPD_CGI)
+ g_query = xstrdup(g_query); /* ok for NULL too */
+ strcpy(urlp, index_page);
+ }
+ if (stat(tptr, &sb) == 0) {
+ /* If URL is a directory with no slash, set up
+ * "HTTP/1.1 302 Found" "Location: /dir/" reply */
+ if (urlp[-1] != '/' && S_ISDIR(sb.st_mode)) {
+ found_moved_temporarily = urlcopy;
+ } else {
#if ENABLE_FEATURE_HTTPD_CONFIG_WITH_SCRIPT_INTERPR
- char *suffix = strrchr(tptr, '.');
- if (suffix) {
- Htaccess *cur;
- for (cur = script_i; cur; cur = cur->next) {
- if (strcmp(cur->before_colon + 1, suffix) == 0) {
- cgi_type = CGI_INTERPRETER;
- break;
+ char *suffix = strrchr(tptr, '.');
+ if (suffix) {
+ Htaccess *cur;
+ for (cur = script_i; cur; cur = cur->next) {
+ if (strcmp(cur->before_colon + 1, suffix) == 0) {
+ cgi_type = CGI_INTERPRETER;
+ break;
+ }
}
}
- }
#endif
- file_size = sb.st_size;
- last_mod = sb.st_mtime;
+ file_size = sb.st_size;
+ last_mod = sb.st_mtime;
+ }
}
- }
#if ENABLE_FEATURE_HTTPD_CGI
- else if (urlp[-1] == '/') {
- /* It's a dir URL and there is no index.html */
- /* Is there cgi-bin/index.cgi? */
- if (access("/cgi-bin/index.cgi"+1, X_OK) != 0)
- send_headers_and_exit(HTTP_NOT_FOUND); /* no */
- cgi_type = CGI_INDEX;
- }
+ else if (urlp[-1] == '/') {
+ /* It's a dir URL and there is no index.html */
+ /* Is there cgi-bin/index.cgi? */
+ if (access("/cgi-bin/index.cgi"+1, X_OK) != 0)
+ send_headers_and_exit(HTTP_NOT_FOUND); /* no */
+ cgi_type = CGI_INDEX;
+ }
#endif
+ }
#if ENABLE_FEATURE_HTTPD_BASIC_AUTH || ENABLE_FEATURE_HTTPD_CGI
/* check_user_passwd() would be confused by added .../index.html, truncate it */
From vda.linux at googlemail.com Wed Mar 29 13:46:32 2023
From: vda.linux at googlemail.com (Denys Vlasenko)
Date: Wed, 29 Mar 2023 15:46:32 +0200
Subject: [git commit] libbb/sha: do not read shaNI variable twice,
and factor out its setting
Message-ID: <20230329134655.A220E835D1@busybox.osuosl.org>
commit: https://git.busybox.net/busybox/commit/?id=a59e5a7d08cb26ec029d00dd11e693765aca17be
branch: https://git.busybox.net/busybox/commit/?id=refs/heads/master
My gcc inlines both calls, so instead of "-20 bytes" I get only this:
function old new delta
sha256_begin 84 83 -1
sha1_begin 114 111 -3
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-4) Total: -4 bytes
Signed-off-by: Denys Vlasenko
---
libbb/hash_md5_sha.c | 28 ++++++++++++++++------------
1 file changed, 16 insertions(+), 12 deletions(-)
diff --git a/libbb/hash_md5_sha.c b/libbb/hash_md5_sha.c
index bbe58c77b..88baf51dc 100644
--- a/libbb/hash_md5_sha.c
+++ b/libbb/hash_md5_sha.c
@@ -23,6 +23,14 @@ static void cpuid(unsigned *eax, unsigned *ebx, unsigned *ecx, unsigned *edx)
);
}
static smallint shaNI;
+static int get_shaNI(void)
+{
+ unsigned eax = 7, ebx = ebx, ecx = 0, edx = edx;
+ cpuid(&eax, &ebx, &ecx, &edx);
+ ebx = ((ebx >> 28) & 2) - 1; /* bit 29 -> 1 or -1 */
+ shaNI = (int)ebx;
+ return (int)ebx;
+}
void FAST_FUNC sha1_process_block64_shaNI(sha1_ctx_t *ctx);
void FAST_FUNC sha256_process_block64_shaNI(sha256_ctx_t *ctx);
# if defined(__i386__)
@@ -1175,12 +1183,10 @@ void FAST_FUNC sha1_begin(sha1_ctx_t *ctx)
#if ENABLE_SHA1_HWACCEL
# if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
{
- if (!shaNI) {
- unsigned eax = 7, ebx = ebx, ecx = 0, edx = edx;
- cpuid(&eax, &ebx, &ecx, &edx);
- shaNI = ((ebx >> 28) & 2) - 1; /* bit 29 -> 1 or -1 */
- }
- if (shaNI > 0)
+ int ni = shaNI;
+ if (!ni)
+ ni = get_shaNI();
+ if (ni > 0)
ctx->process_block = sha1_process_block64_shaNI;
}
# endif
@@ -1229,12 +1235,10 @@ void FAST_FUNC sha256_begin(sha256_ctx_t *ctx)
#if ENABLE_SHA256_HWACCEL
# if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
{
- if (!shaNI) {
- unsigned eax = 7, ebx = ebx, ecx = 0, edx = edx;
- cpuid(&eax, &ebx, &ecx, &edx);
- shaNI = ((ebx >> 28) & 2) - 1; /* bit 29 -> 1 or -1 */
- }
- if (shaNI > 0)
+ int ni = shaNI;
+ if (!ni)
+ ni = get_shaNI();
+ if (ni > 0)
ctx->process_block = sha256_process_block64_shaNI;
}
# endif
From vda.linux at googlemail.com Wed Mar 29 13:17:00 2023
From: vda.linux at googlemail.com (Denys Vlasenko)
Date: Wed, 29 Mar 2023 15:17:00 +0200
Subject: [git commit] libbb/sha: fix sha-NI instruction detection
Message-ID: <20230329134655.9758283697@busybox.osuosl.org>
commit: https://git.busybox.net/busybox/commit/?id=bd76b75f72f717150b909e8c64edfda725cabe11
branch: https://git.busybox.net/busybox/commit/?id=refs/heads/master
Signed-off-by: Denys Vlasenko
---
libbb/hash_md5_sha.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libbb/hash_md5_sha.c b/libbb/hash_md5_sha.c
index 880ffab01..bbe58c77b 100644
--- a/libbb/hash_md5_sha.c
+++ b/libbb/hash_md5_sha.c
@@ -1178,7 +1178,7 @@ void FAST_FUNC sha1_begin(sha1_ctx_t *ctx)
if (!shaNI) {
unsigned eax = 7, ebx = ebx, ecx = 0, edx = edx;
cpuid(&eax, &ebx, &ecx, &edx);
- shaNI = ((ebx >> 29) << 1) - 1;
+ shaNI = ((ebx >> 28) & 2) - 1; /* bit 29 -> 1 or -1 */
}
if (shaNI > 0)
ctx->process_block = sha1_process_block64_shaNI;
@@ -1232,7 +1232,7 @@ void FAST_FUNC sha256_begin(sha256_ctx_t *ctx)
if (!shaNI) {
unsigned eax = 7, ebx = ebx, ecx = 0, edx = edx;
cpuid(&eax, &ebx, &ecx, &edx);
- shaNI = ((ebx >> 29) << 1) - 1;
+ shaNI = ((ebx >> 28) & 2) - 1; /* bit 29 -> 1 or -1 */
}
if (shaNI > 0)
ctx->process_block = sha256_process_block64_shaNI;
From vda.linux at googlemail.com Wed Mar 29 13:50:40 2023
From: vda.linux at googlemail.com (Denys Vlasenko)
Date: Wed, 29 Mar 2023 15:50:40 +0200
Subject: [git commit branch/1_36_stable] libbb/sha: fix sha-NI instruction
detection
Message-ID: <20230329135046.4921E8369B@busybox.osuosl.org>
commit: https://git.busybox.net/busybox/commit/?id=8d198665a0d09c3f22f3a12234809f46b1c2b04a
branch: https://git.busybox.net/busybox/commit/?id=refs/heads/1_36_stable
Signed-off-by: Denys Vlasenko
---
libbb/hash_md5_sha.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libbb/hash_md5_sha.c b/libbb/hash_md5_sha.c
index 880ffab01..bbe58c77b 100644
--- a/libbb/hash_md5_sha.c
+++ b/libbb/hash_md5_sha.c
@@ -1178,7 +1178,7 @@ void FAST_FUNC sha1_begin(sha1_ctx_t *ctx)
if (!shaNI) {
unsigned eax = 7, ebx = ebx, ecx = 0, edx = edx;
cpuid(&eax, &ebx, &ecx, &edx);
- shaNI = ((ebx >> 29) << 1) - 1;
+ shaNI = ((ebx >> 28) & 2) - 1; /* bit 29 -> 1 or -1 */
}
if (shaNI > 0)
ctx->process_block = sha1_process_block64_shaNI;
@@ -1232,7 +1232,7 @@ void FAST_FUNC sha256_begin(sha256_ctx_t *ctx)
if (!shaNI) {
unsigned eax = 7, ebx = ebx, ecx = 0, edx = edx;
cpuid(&eax, &ebx, &ecx, &edx);
- shaNI = ((ebx >> 29) << 1) - 1;
+ shaNI = ((ebx >> 28) & 2) - 1; /* bit 29 -> 1 or -1 */
}
if (shaNI > 0)
ctx->process_block = sha256_process_block64_shaNI;
From vda.linux at googlemail.com Wed Mar 29 14:45:13 2023
From: vda.linux at googlemail.com (Denys Vlasenko)
Date: Wed, 29 Mar 2023 16:45:13 +0200
Subject: [git commit] lineedit: fix matching of directories when searching PATH
Message-ID: <20230329144639.BC602836A6@busybox.osuosl.org>
commit: https://git.busybox.net/busybox/commit/?id=f2e659415ad59906124fca963040c8884746feed
branch: https://git.busybox.net/busybox/commit/?id=refs/heads/master
Commit 8baa643a3 (lineedit: match local directories when searching
PATH) included subdirectories of the current directory in the search
when tab-completing commands.
Unfortunately a short time later commit 1d180cd74 (lineedit: use
strncmp instead of is_prefixed_with (we know the length)) broke
this feature by returning an incorrect length for the array of paths.
Fix the length and reinstate matching of subdirectories.
Signed-off-by: Ron Yorston
Signed-off-by: Denys Vlasenko
---
libbb/lineedit.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libbb/lineedit.c b/libbb/lineedit.c
index b942f540a..625884adf 100644
--- a/libbb/lineedit.c
+++ b/libbb/lineedit.c
@@ -825,8 +825,8 @@ static unsigned path_parse(char ***p)
res[npth++] = tmp;
}
/* special case: "match subdirectories of the current directory" */
- /*res[npth++] = NULL; - filled by xzalloc() */
- return npth;
+ /*res[npth] = NULL; - filled by xzalloc() */
+ return npth + 1;
}
/* Complete command, directory or file name.
From vda.linux at googlemail.com Wed Mar 29 14:45:13 2023
From: vda.linux at googlemail.com (Denys Vlasenko)
Date: Wed, 29 Mar 2023 16:45:13 +0200
Subject: [git commit] ash: make EPOCH variables work if RANDOM is disabled
Message-ID: <20230329144639.CA820836A7@busybox.osuosl.org>
commit: https://git.busybox.net/busybox/commit/?id=470fa7b3648da2ea120d65fa7cde69cad0421353
branch: https://git.busybox.net/busybox/commit/?id=refs/heads/master
Commit 1d37186fe2 (ash: add bash-compatible EPOCH variables) added
support for the EPOCHSECONDS and EPOCHREALTIME variables.
These variables are dynamic and therefore require the VDYNAMIC flag
to be non-zero. However, this is only the case if support for the
RANDOM variable is enabled.
Give VDYNAMIC a non-zero value if either EPOCH variables or RANDOM
are enabled.
Signed-off-by: Ron Yorston
Signed-off-by: Denys Vlasenko
---
shell/ash.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/shell/ash.c b/shell/ash.c
index 5f8c8ea19..559566b58 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -2087,7 +2087,7 @@ struct localvar {
#define VNOFUNC 0x40 /* don't call the callback function */
#define VNOSET 0x80 /* do not set variable - just readonly test */
#define VNOSAVE 0x100 /* when text is on the heap before setvareq */
-#if ENABLE_ASH_RANDOM_SUPPORT
+#if ENABLE_ASH_RANDOM_SUPPORT || BASH_EPOCH_VARS
# define VDYNAMIC 0x200 /* dynamic variable */
#else
# define VDYNAMIC 0
From bugzilla at busybox.net Thu Mar 30 20:49:03 2023
From: bugzilla at busybox.net (bugzilla at busybox.net)
Date: Thu, 30 Mar 2023 20:49:03 +0000
Subject: [Bug 15511] New: setpriv FEATURE_SETPRIV_CAPABILITY_NAMES has no
effect
Message-ID:
https://bugs.busybox.net/show_bug.cgi?id=15511
Bug ID: 15511
Summary: setpriv FEATURE_SETPRIV_CAPABILITY_NAMES has no effect
Product: Busybox
Version: 1.35.x
Hardware: All
OS: Linux
Status: NEW
Severity: normal
Priority: P5
Component: Other
Assignee: unassigned at busybox.net
Reporter: axel at axelfontaine.com
CC: busybox-cvs at busybox.net
Target Milestone: ---
setpriv --inh-caps=+cap_chown myprg
fails with:
setpriv: unknown capability 'cap_chown'
even when FEATURE_SETPRIV_CAPABILITY_NAMES has been set
Tested on 1.36.0
--
You are receiving this mail because:
You are on the CC list for the bug.
From bugzilla at busybox.net Fri Mar 31 08:22:57 2023
From: bugzilla at busybox.net (bugzilla at busybox.net)
Date: Fri, 31 Mar 2023 08:22:57 +0000
Subject: [Bug 15516] New: setpriv has no way to set bounding-set
Message-ID:
https://bugs.busybox.net/show_bug.cgi?id=15516
Bug ID: 15516
Summary: setpriv has no way to set bounding-set
Product: Busybox
Version: 1.35.x
Hardware: All
OS: Linux
Status: NEW
Severity: normal
Priority: P5
Component: Other
Assignee: unassigned at busybox.net
Reporter: axel at axelfontaine.com
CC: busybox-cvs at busybox.net
Target Milestone: ---
In util-linux, this is handled by the --bounding-set arg.
See
https://github.com/util-linux/util-linux/blob/master/sys-utils/setpriv.1.adoc
--
You are receiving this mail because:
You are on the CC list for the bug.
From vda.linux at googlemail.com Fri Mar 31 11:15:58 2023
From: vda.linux at googlemail.com (Denys Vlasenko)
Date: Fri, 31 Mar 2023 13:15:58 +0200
Subject: [git commit] modprobe: call finit_module with
MODULE_INIT_COMPRESSED_FILE if module name doesn't end with .ko
Message-ID: <20230331111934.413F383708@busybox.osuosl.org>
commit: https://git.busybox.net/busybox/commit/?id=af5277f883e8fc2e0236aa9ecc5115ecaffd0ccb
branch: https://git.busybox.net/busybox/commit/?id=refs/heads/master
IOW: if name doesn't end with .ko, assume it's .gz/.xz or similar,
and ask kernel to uncompress it.
If finit_module(MODULE_INIT_COMPRESSED_FILE) fails, retry with
finit_module(0).
function old new delta
bb_init_module 151 197 +46
Signed-off-by: Denys Vlasenko
---
modutils/modprobe-small.c | 12 +++++++++++-
modutils/modutils.c | 12 +++++++++++-
2 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/modutils/modprobe-small.c b/modutils/modprobe-small.c
index b61651621..77e42e3fb 100644
--- a/modutils/modprobe-small.c
+++ b/modutils/modprobe-small.c
@@ -33,6 +33,9 @@
#define delete_module(mod, flags) syscall(__NR_delete_module, mod, flags)
#ifdef __NR_finit_module
# define finit_module(fd, uargs, flags) syscall(__NR_finit_module, fd, uargs, flags)
+# ifndef MODULE_INIT_COMPRESSED_FILE
+# define MODULE_INIT_COMPRESSED_FILE 4
+# endif
#endif
/* linux/include/linux/module.h has limit of 64 chars on module names */
#undef MODULE_NAME_LEN
@@ -272,7 +275,14 @@ static int load_module(const char *fname, const char *options)
{
int fd = open(fname, O_RDONLY | O_CLOEXEC);
if (fd >= 0) {
- r = finit_module(fd, options, 0) != 0;
+ int flags = is_suffixed_with(fname, ".ko") ? 0 : MODULE_INIT_COMPRESSED_FILE;
+ for (;;) {
+ r = finit_module(fd, options, flags);
+ if (r == 0 || flags == 0)
+ break;
+ /* Loading non-.ko named uncompressed module? Not likely, but let's try it */
+ flags = 0;
+ }
close(fd);
}
}
diff --git a/modutils/modutils.c b/modutils/modutils.c
index f7ad5e805..cbff20961 100644
--- a/modutils/modutils.c
+++ b/modutils/modutils.c
@@ -12,6 +12,9 @@
#define init_module(mod, len, opts) syscall(__NR_init_module, mod, len, opts)
#if defined(__NR_finit_module)
# define finit_module(fd, uargs, flags) syscall(__NR_finit_module, fd, uargs, flags)
+# ifndef MODULE_INIT_COMPRESSED_FILE
+# define MODULE_INIT_COMPRESSED_FILE 4
+# endif
#endif
#define delete_module(mod, flags) syscall(__NR_delete_module, mod, flags)
@@ -217,7 +220,14 @@ int FAST_FUNC bb_init_module(const char *filename, const char *options)
{
int fd = open(filename, O_RDONLY | O_CLOEXEC);
if (fd >= 0) {
- rc = finit_module(fd, options, 0) != 0;
+ int flags = is_suffixed_with(filename, ".ko") ? 0 : MODULE_INIT_COMPRESSED_FILE;
+ for (;;) {
+ rc = finit_module(fd, options, flags);
+ if (rc == 0 || flags == 0)
+ break;
+ /* Loading non-.ko named uncompressed module? Not likely, but let's try it */
+ flags = 0;
+ }
close(fd);
if (rc == 0)
return rc;
From vda.linux at googlemail.com Fri Mar 31 12:22:56 2023
From: vda.linux at googlemail.com (Denys Vlasenko)
Date: Fri, 31 Mar 2023 14:22:56 +0200
Subject: [git commit] ash: improve trap and jobs builtins in child shells
Message-ID: <20230331135347.DF27783724@busybox.osuosl.org>
commit: https://git.busybox.net/busybox/commit/?id=098cd7ece44bf7ab7ae38dc00dd574af79a9bad8
branch: https://git.busybox.net/busybox/commit/?id=refs/heads/master
The trap and jobs builtins can be used to report information about
traps and jobs. This works when they're called from the current
shell but in a child shell the required information is usually
cleared. Special hacks allow:
- trap to work with command substitution;
- jobs to work with command substitution or in a pipeline.
Neither works with process substitution.
- Relax the test for the trap hack so it also supports pipelines.
- Pass the command to be evaluated to forkshell() in evalbackcmd()
so trap and jobs both work with process substitution.
function old new delta
forkchild 629 640 +11
argstr 1502 1496 -6
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 11/-6) Total: 5 bytes
Signed-off-by: Ron Yorston
Signed-off-by: Denys Vlasenko
---
shell/ash.c | 13 +++++++------
shell/ash_test/ash-signals/usage.right | 12 ++++++++++++
shell/ash_test/ash-signals/usage.tests | 12 ++++++++++++
3 files changed, 31 insertions(+), 6 deletions(-)
diff --git a/shell/ash.c b/shell/ash.c
index 559566b58..40b921be1 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -5190,8 +5190,7 @@ forkchild(struct job *jp, union node *n, int mode)
closescript();
- if (mode == FORK_NOJOB /* is it `xxx` ? */
- && n && n->type == NCMD /* is it single cmd? */
+ if (n && n->type == NCMD /* is it single cmd? */
/* && n->ncmd.args->type == NARG - always true? */
&& n->ncmd.args && strcmp(n->ncmd.args->narg.text, "trap") == 0
&& n->ncmd.args->narg.next == NULL /* "trap" with no arguments */
@@ -5285,10 +5284,12 @@ forkchild(struct job *jp, union node *n, int mode)
) {
TRACE(("Job hack\n"));
/* "jobs": we do not want to clear job list for it,
- * instead we remove only _its_ own_ job from job list.
+ * instead we remove only _its_ own_ job from job list
+ * (if it has one).
* This makes "jobs .... | cat" more useful.
*/
- freejob(curjob);
+ if (jp)
+ freejob(curjob);
return;
}
#endif
@@ -6607,9 +6608,9 @@ evalbackcmd(union node *n, struct backcmd *result
if (pipe(pip) < 0)
ash_msg_and_raise_perror("can't create pipe");
- /* process substitution uses NULL job/node, like openhere() */
+ /* process substitution uses NULL job, like openhere() */
jp = (ctl == CTLBACKQ) ? makejob(/*n,*/ 1) : NULL;
- if (forkshell(jp, (ctl == CTLBACKQ) ? n : NULL, FORK_NOJOB) == 0) {
+ if (forkshell(jp, n, FORK_NOJOB) == 0) {
/* child */
FORCE_INT_ON;
close(pip[ip]);
diff --git a/shell/ash_test/ash-signals/usage.right b/shell/ash_test/ash-signals/usage.right
index c0dbd6c3c..df1ed2dd7 100644
--- a/shell/ash_test/ash-signals/usage.right
+++ b/shell/ash_test/ash-signals/usage.right
@@ -6,6 +6,18 @@ trap -- 'a' INT
trap -- 'a' USR1
trap -- 'a' USR2
___
+trap -- 'a' EXIT trap -- 'a' INT trap -- 'a' USR1 trap -- 'a' USR2
+___
+trap -- 'a' EXIT
+trap -- 'a' INT
+trap -- 'a' USR1
+trap -- 'a' USR2
+___
+trap -- 'a' EXIT
+trap -- 'a' INT
+trap -- 'a' USR1
+trap -- 'a' USR2
+___
___
trap -- 'a' USR1
trap -- 'a' USR2
diff --git a/shell/ash_test/ash-signals/usage.tests b/shell/ash_test/ash-signals/usage.tests
index d29c6e74a..34e24cceb 100755
--- a/shell/ash_test/ash-signals/usage.tests
+++ b/shell/ash_test/ash-signals/usage.tests
@@ -10,6 +10,18 @@ trap "a" EXIT INT USR1 USR2
echo ___
trap
+# show them by command substitution
+echo ___
+echo $(trap)
+
+# show them by pipe
+echo ___
+trap | cat
+
+# show them by process substitution
+echo ___
+cat <(trap)
+
# clear one
echo ___
trap 0 INT
From bugzilla at busybox.net Fri Mar 31 14:47:10 2023
From: bugzilla at busybox.net (bugzilla at busybox.net)
Date: Fri, 31 Mar 2023 14:47:10 +0000
Subject: [Bug 15476] cd allows odd .... directory
In-Reply-To:
References:
Message-ID:
https://bugs.busybox.net/show_bug.cgi?id=15476
--- Comment #1 from Denys Vlasenko ---
cd DIR
cdcmd() -> docd() -> updatepwd(), and updatepwd has the code which "normalizes"
the DIR: prepends current dir if DIR is not absolute, then eliminates
"SUBDIR/.." sections.
The bug is, it does not care whether SUBDIR exists:
cd BOGUSDIR/../existing_dir
works.
The same exact code is in dash. Needs to be fixed there first.
--
You are receiving this mail because:
You are on the CC list for the bug.
From vda.linux at googlemail.com Fri Mar 31 19:35:50 2023
From: vda.linux at googlemail.com (Denys Vlasenko)
Date: Fri, 31 Mar 2023 21:35:50 +0200
Subject: [git commit] ash: exec: Stricter pathopt parsing - lost chunk
Message-ID: <20230331193754.11A5483734@busybox.osuosl.org>
commit: https://git.busybox.net/busybox/commit/?id=262a84547798cf795d9748329f2ad251117801cc
branch: https://git.busybox.net/busybox/commit/?id=refs/heads/master
Signed-off-by: Denys Vlasenko
---
shell/ash.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/shell/ash.c b/shell/ash.c
index 40b921be1..45e552217 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -2959,7 +2959,7 @@ cdcmd(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
if (!*dest)
dest = ".";
path = bltinlookup("CDPATH");
- while (p = path, (len = padvance(&path, dest)) >= 0) {
+ while (p = path, (len = padvance_magic(&path, dest, 0)) >= 0) {
c = *p;
p = stalloc(len);