freebsd-src/bin
Ganael Laplanche 681fd2bed8 pax: Terminate loop for empty directory names
Pax can sometimes loop forever. For example:

$ mkdir -p /tmp/src/foo/bar
$ rm -rf /tmp/dst ; mkdir -p /tmp/dst
$ cd /tmp/src
$ echo 'foo/bar/' | /bin/pax -r -w -d -pe "/tmp/dst"
<looping infinitely>

Here, pax(1) infinitely deletes and re-creates /tmp/dst/foo/bar/.

The problem is that chk_path() (bin/pax/file_subs.c), called from
node_creat() also creates the leaf directory when a trailing '/' appears
in the directory name to create. When the execution goes back from
chk_path() to node_creat(), the function still cannot create the leaf
directory (it has been created by chk_path()), so it unlinks it and
calls node_creat() again. The function re-creates it, and so on...

In node_creat() detect trailing slashes and not create a leaf directory,
but only intermediate ones.

PR: 277060
Reviewed by: imp
2024-06-21 10:39:09 -06:00
..
cat cat: Missed a couple. 2024-05-10 13:05:45 +02:00
chflags
chio
chmod
cp cp: avoid a resource leak 2024-05-23 12:04:43 -06:00
cpuset
csh csh: Remove hardlink /.cshrc 2024-05-29 09:56:58 +02:00
date date.1: Note that nanosecond support is to appear first in 14.1 2024-05-02 22:48:08 +02:00
dd
df
domainname
echo echo(1): Add EXAMPLES 2024-04-08 18:35:40 +02:00
ed
expr
freebsd-version
getfacl
hostname
kenv
kill
ln ln: Improve link(1) variant of ln(1). 2024-04-04 16:14:50 +02:00
ls
mkdir
mv mv: Set file flags after setting file times 2024-04-16 09:18:15 -04:00
nproc nproc: Prefer sys/cdefs.h __unreachable over the builtin 2024-04-12 16:39:05 -06:00
pax pax: Terminate loop for empty directory names 2024-06-21 10:39:09 -06:00
pkill
ps man filesystems: fix xrefs after move to section 4 2024-05-16 10:25:29 -06:00
pwait
pwd
realpath
rm
rmail
rmdir /bin/rmdir: Exit with status 2 for invalid arguments 2024-05-11 13:13:28 -06:00
setfacl
sh
sleep
stty
sync sync.8: Document that the "sync dance" is not a thing 2024-04-25 11:49:50 +02:00
test
tests
timeout
uuidgen uuidgen(1): Add EXAMPLES to manual page 2024-04-27 20:53:59 +02:00
Makefile
Makefile.inc