Hello Paul,

the FSF paperwork is done (gnu.org #2777010), so here is the test case
again, as a patch on top of current master (72b50fa8).

It is the test from my first mail without the change to src/misc.c:
file names with one-, two- and three-digit octal escapes, read from a
-T list and given as operands.  It passes on master.  Without your
commit cfdb891b it fails with

  tar: a\005b: Cannot stat: No such file or directory

Full suite with the patch: 230 passed, 37 skipped, on Debian 13 with
gcc.

Regards,
Nexory
From 06a90439754cc9db4bc3004efea5bb016290382b Mon Sep 17 00:00:00 2001
From: Nexory <[email protected]>
Date: Fri, 13 Nov 2026 15:09:28 +0100
Subject: [PATCH] tests: check octal escapes in file names

* tests/unquote.at: New file.
* tests/Makefile.am (TESTSUITE_AT): Add it.
* tests/testsuite.at: Include it.
---
 tests/Makefile.am  |  1 +
 tests/testsuite.at |  1 +
 tests/unquote.at   | 62 ++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 64 insertions(+)
 create mode 100644 tests/unquote.at

diff --git a/tests/Makefile.am b/tests/Makefile.am
index 81ac3075..7103dcc6 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -286,6 +286,7 @@ TESTSUITE_AT = \
  time01.at\
  time02.at\
  truncate.at\
+ unquote.at\
  update.at\
  update01.at\
  update02.at\
diff --git a/tests/testsuite.at b/tests/testsuite.at
index 6243f0d8..9e3eaac5 100644
--- a/tests/testsuite.at
+++ b/tests/testsuite.at
@@ -266,6 +266,7 @@ m4_include([T-zfile.at])
 m4_include([T-nonl.at])
 m4_include([T-dir00.at])
 m4_include([T-dir01.at])
+m4_include([unquote.at])
 
 AT_BANNER([Various options])
 m4_include([indexfile.at])
diff --git a/tests/unquote.at b/tests/unquote.at
new file mode 100644
index 00000000..d2a8729a
--- /dev/null
+++ b/tests/unquote.at
@@ -0,0 +1,62 @@
+# Test suite for GNU tar.                             -*- Autotest -*-
+# Copyright 2026 Free Software Foundation, Inc.
+#
+# This file is part of GNU tar.
+#
+# GNU tar is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# GNU tar is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Octal escapes of one, two and three digits in file names given in a
+# --files-from list or as operands.  A two-digit escape such as \53
+# not followed by another octal digit was decoded as its first digit
+# alone.  A third digit that would overflow a byte, as in \400, ends
+# the escape after two digits.
+
+AT_SETUP([octal escapes in file names])
+AT_KEYWORDS([files-from unquote octal])
+
+AT_DATA([file-list],
+[a\53b
+a\53
+cA\101
+cA\1011
+e\400
+f\7g
+])
+
+AT_TAR_CHECK([
+genfile --file 'a+b'
+genfile --file 'a+'
+genfile --file 'cAA'
+genfile --file 'cAA1'
+genfile --file 'e 0'
+genfile --file "`printf 'f\007g'`"
+
+tar cvf archive -T ../file-list
+echo ==
+tar cvf archive 'a\53b' 'cA\101'
+],
+[0],
+[a+b
+a+
+cAA
+cAA1
+e 0
+f\ag
+==
+a+b
+cAA
+],
+[],[],[],[ustar]) # Testing one format is enough
+
+AT_CLEANUP
-- 
2.47.3

Reply via email to