Ralph Corderoy wrote in
<20240611080506.73D7B21309(a)orac.inputplus.co.uk>:
..
|>>> "Show me the last 5 files read in a directory tree"
...
|Neither does GNU ‘stat -c '%X %n'’.
Unfortunately "stat" is not portable.
...
|David Wheeler has a nice article he maintains on unusual characters in
|filenames: how to cope, and what other systems do, e.g. Plan 9.
|
| Fixing Unix/Linux/POSIX filenames: control characters (such as
| newline), leading dashes, and other problems
| David A. Wheeler, 2023-08-22 (originally 2009-03-24)
|
https://dwheeler.com/essays/fixing-unix-linux-filenames.html
|
|As he writes, Linux already returns EINVAL for some paths on some
|filesystem types. A mount option which had a syscall return an error on
|meeting an insensible path would be useful. It avoids any attempt at
|escapement and its greater risk of implementation errors. I could
|always re-mount some old volume without the option to list the directory
|and fix up its entries. The second-best day to plant a tree is today.
dash is currently implementing $'' quotes (that will be part of
the next POSIX i think). I want to mention again, eh, please let
me just paste something of mine from ossec from may, as i really
think in $'' could lie sanity also for such things:
While here please let me back the not yet gracefully supported
shell escape mechanism $''.
The current approach seems to be to be as atomic as possible:
# touch $(printf 'a\rb\tc\a')
# ll
->
-rw-r----- 1 steffen steffen 0 May 3 00:46 'c'$'\a'
-rw-r----- 1 steffen steffen 0 May 3 00:46
'a'$'\r''b'
(GNU coreutils). Isn't that just terrible? In (the development
version of) my mailer tab-completion leads to
#..mbox? /tmp/<TAB>
$'a\rb'
$'c\a'
which i find at least a little bit better. (Do not even think
about looking in its implementation though, look ICU or what.)
And even though currently unsupported, it should be said that with
"grapheme clusters" and in general things like ligatures and other
such language-specific constructs which need to look at
surroundings -- in general interfaces like towupper() etc are not
useful in global context, entire sentences have to be looked at as
a whole due to this! --, shell quotes should be extended to the
largest possible range possible. Ie, all the iconv(3)s that are
currently used because of a lack of other interfaces should be
enabled to see the longest possible (sub)string, not the most
atomar, as seen above.
Anyhow, with proper $'' quoting that also offers \$VAR/\${VAR} for
example (which acts like "$VAR" in double quotes; and \c@==NUL,
xx) there would be a way to a have a holistic quoting mechanism.
Some more complaining of an idiot who does not understand why ISO
C and more standardized holes in the \U and \u (Unicode code
point, hexadecimal) ranges.
--steffen
|
|Der Kragenbaer, The moon bear,
|der holt sich munter he cheerfully and one by one
|einen nach dem anderen runter wa.ks himself off
|(By Robert Gernhardt)