The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
From: Steffen Nurpmeso <steffen@sdaoden.eu>
To: Ralph Corderoy <ralph@inputplus.co.uk>
Cc: tuhs@tuhs.org
Subject: [TUHS] Re: Likely a one-liner in Unix
Date: Tue, 11 Jun 2024 23:01:02 +0200	[thread overview]
Message-ID: <20240611210102.P8tiuiAL@steffen%sdaoden.eu> (raw)
In-Reply-To: <20240611080506.73D7B21309@orac.inputplus.co.uk>

Ralph Corderoy wrote in
 <20240611080506.73D7B21309@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)

      reply	other threads:[~2024-06-11 21:37 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-09 11:34 [TUHS] Re: most direct Unix descendant Douglas McIlroy
2024-06-09 11:59 ` A. P. Garcia
2024-06-09 12:31   ` Ralph Corderoy
2024-06-09 14:06     ` A. P. Garcia
2024-06-10  5:13   ` Ed Bradford
2024-06-10  5:25     ` G. Branden Robinson
2024-06-10  8:39     ` Dave Horsfall
2024-06-10  9:36       ` Marc Donner
2024-06-10 19:40         ` Steffen Nurpmeso
2024-06-10 20:09           ` Marc Donner
2024-06-10 20:19             ` Steffen Nurpmeso
2024-06-11  3:15       ` [TUHS] Re: Likely a one-liner in Unix James Frew
2024-06-11  8:05         ` Ralph Corderoy
2024-06-11 21:01           ` Steffen Nurpmeso [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240611210102.P8tiuiAL@steffen%sdaoden.eu \
    --to=steffen@sdaoden.eu \
    --cc=ralph@inputplus.co.uk \
    --cc=tuhs@tuhs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).