[Bug 277060] pax(1) hangs in copy mode under certain conditions

From: <bugzilla-noreply_at_freebsd.org>
Date: Fri, 07 Jun 2024 17:00:19 UTC

Ganael LAPLANCHE <martymac@FreeBSD.org> changed:

           What    |Removed                     |Added
                 CC|                            |martymac@FreeBSD.org
             Status|New                         |In Progress

--- Comment #1 from Ganael LAPLANCHE <martymac@FreeBSD.org> ---

I am facing the same bug too :

$ 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...

A possible fix is to make node_creat() detect trailing slashes so it does NOT
create a leaf directory but only intermediate ones. I've added a simple check
in that way in the attached patch.

Best regards,


You are receiving this mail because:
You are the assignee for the bug.