Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 21 Jun 2024 16:44:06 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 277060] pax(1) hangs when copying directories with a trailing slash
Message-ID:  <bug-277060-227-mHitOqxTs9@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-277060-227@https.bugs.freebsd.org/bugzilla/>
References:  <bug-277060-227@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D277060

--- Comment #5 from commit-hook@FreeBSD.org ---
A commit in branch main references this bug:

URL:
https://cgit.FreeBSD.org/src/commit/?id=3D681fd2bed8eaba88693867ba928a1c03a=
5b152cc

commit 681fd2bed8eaba88693867ba928a1c03a5b152cc
Author:     Ganael Laplanche <ganael.laplanche@martymac.org>
AuthorDate: 2024-06-21 16:39:09 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2024-06-21 16:39:09 +0000

    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

 bin/pax/file_subs.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-277060-227-mHitOqxTs9>