On 27/05/2023 13:54, наб wrote:
Package: coreutils
Version: 8.32-4+b1
Version: 9.1-1
Severity: normal

Dear Maintainer,
   $ echo | split --additional-suffix=asd/
   split: xaaasd/: Is a directory
   $ echo | split --additional-suffix=asd/asd/
   split: invalid suffix ‘asd/asd/’, contains directory separator
   Try 'split --help' for more information.
   $ echo | split --additional-suffix=asd/asd
   split: invalid suffix ‘asd/asd’, contains directory separator
   Try 'split --help' for more information.
   $ echo | split --additional-suffix=/
   split: invalid suffix ‘/’, contains directory separator
   Try 'split --help' for more information.

Also, I don't really see a reason to reject slashes in there anyway?
Forbidding
   $ printf abcd > a
   $ printf ABCD > A
   $ mkdir 0 1 2 3
   $ split -b1 --additional-suffix=/a -da1 a ''
   $ split -b1 --additional-suffix=/A -da1 A ''
   $ find
   .
   ./0
   ./0/A
   ./0/a
   ./3
   ./3/A
   ./3/a
   ./2
   ./2/A
   ./2/a
   ./1
   ./1/A
   ./1/a
   ./A
   ./a
   $ grep . ?/*
   0/a:a
   0/A:A
   1/a:b
   1/A:B
   2/a:c
   2/A:C
   3/a:d
   3/A:D
seems relatively pointless.


Yes we should fix the inconsistency here at least.
The "slash detection" logic was copied from mktemp,
so we'll need to look at that too.

$ mktemp --tmpdir=. --suffix=a/
mktemp: failed to create file via template ‘./tmp.XXXXXXXXXXa/’: Is a directory
$ mktemp --suffix=a/
mktemp: failed to create file via template ‘/tmp/tmp.XXXXXXXXXXa/’: Is a 
directory

Though mktemp can create dirs, so perhaps the trailing / is allowed for that?
Though docs say a slash isn't allowed in suffix, so it's probably an oversight.

Note templates for mktemp can contain dirs,
so it's only the combo of dirs with /tmp
or sub dirs in --suffix that are disallowed,
which makes sense for mktemp.

For split it may well be simplest to just remove the restriction.

cheers,
Pádraig

Reply via email to