[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

tar 1.33 regression on OpenBSD (extrac09 getcwd)

From: Christian Weisgerber
Subject: tar 1.33 regression on OpenBSD (extrac09 getcwd)
Date: Tue, 12 Jan 2021 23:47:48 +0100

There is a regression in tar 1.33 on OpenBSD.  Thanks to Stefan Hagen
for figuring out the details.

 89: extracting even when . and .. are unreadable    FAILED (extrac09.at:37)    

The key part of the test:

  mkdir dir
  mkdir dir/sub
  mkdir dir/sub/extract
  genfile --file dir/sub/f
  cd dir/sub

  tar -cf archive.tar f

  chmod a-r . ..
  tar -xvf archive.tar -C extract f

And the failure of the "tar -xvf ..." command:

  tar: .: Cannot getcwd: Permission denied
  tar: Error is not recoverable: exiting now

The regression has been introduced with commit 66162927ebdf,
"Check return value from xgetcwd".  Specifically, this chunk:

@@ -922,6 +920,8 @@ chdir_arg (char const *dir)
          wd[wd_count].name = ".";
          wd[wd_count].abspath = xgetcwd ();
+         if (!wd[wd_count].abspath)
+           call_arg_fatal ("getcwd", ".");
          wd[wd_count].fd = AT_FDCWD;

A trace shows that the native system call returns EACCES, which
conforms with POSIX.

 13845 tar      CALL  __getcwd(0x3fd723c000,1024)
 13845 tar      RET   __getcwd -1 errno 13 Permission denied

Christian "naddy" Weisgerber                          naddy@mips.inka.de

reply via email to

[Prev in Thread] Current Thread [Next in Thread]