Bug 31712

Summary: tar filtered with zstd and "-" subdirectory
Product: Mageia Reporter: Yves DEMUR <yves.demur>
Component: RPM PackagesAssignee: Mageia Bug Squad <bugsquad>
Status: RESOLVED INVALID QA Contact:
Severity: normal    
Priority: Normal CC: davidwhodgins, lewyssmith
Version: 8   
Target Milestone: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Source RPM: CVE:
Status comment:
Attachments: test bash script getting error when "-" exists, and no error if "-" does not exist

Description Yves DEMUR 2023-03-21 22:42:57 CET
Description of problem:
When using "tar -tvf - --zstd |", if a "-" subdirectory exists in the working directory, then zstd sends an error message "zstd: /*stdin*\: unsupported format"
I had the problem with a "tar -cf - --zstd |" in a huge bash script but I cannot reproduce it, only "tar -tvf - --zstd |" gets the error in my test script

Version-Release number of selected component (if applicable):
tar 1.33, zstd v1.4.8

How reproducible:
See the bash script in http://yves.demur.free.fr/bug_tar_zstd01.bash.zip

Steps to Reproduce:
1.
2.
3.
Comment 1 Yves DEMUR 2023-03-21 22:45:38 CET
Created attachment 13748 [details]
test bash script getting error when "-" exists, and no error if "-" does not exist
Comment 2 Lewis Smith 2023-03-22 21:35:17 CET
First, it looks as if the fault is with zstd, since it is that which is complaining.
I have long looked at the attached script, and wonder whether it is necessary to illustrate the fault. It makes heavy reading; is it for running?

Are you saying that the problem arises if a subdirectory starts with a '-...', which mkdir does not seem to allow. Or if any directory name includes '-'?
Can you give an example of a pathname which throws the error? Or a short directory 'tree' illustrating it?
Can you demonstrate the error with zstd alone? Or does it only happen if that is fed from tar -tfv ?

Status: NEW => NEEDINFO
CC: (none) => lewyssmith

Comment 3 Dave Hodgins 2023-03-22 22:20:23 CET
From the common options of info mkdir ...
   A single '-' operand is not really an option, though it looks like
one.  It stands for a file operand, and some tools treat it as standard
input, or as standard output if that is clear from the context.  For
example, 'sort -' reads from standard input, and is equivalent to plain
'sort'.  Unless otherwise specified, a '-' can appear as any operand
that requires a file name.

The zstd command is like the sort command in that it can take it's input
from stdin rather then a file by specifying just a hyphen as the name.
Since the file name list is expanded by bash, not by zstd, having both
input names and a hyphen is not allowed.

Closing as invalid. While it doesn't work, it's not supposed to work with
a file name of just a -.

CC: (none) => davidwhodgins
Status: NEEDINFO => RESOLVED
Resolution: (none) => INVALID