Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Fixing swap1_stop



On Thu, 17 Aug 2017 15:12:07 +0700 Robert Elz <kre%munnari.OZ.AU@localhost> wrote:

>     Date:        Wed, 16 Aug 2017 22:25:40 -0400
>     From:        "Ian D. Leroux" <idleroux%fastmail.fm@localhost>
>     Message-ID:  <20170816222540.de4ac3150f5ec12713a91b8b%fastmail.fm@localhost>
>
>   | If we $'' the filenames, then we have to make
>   | sure that the filename contains no C-type escapes
> 
> Yes, any \'s in the name need to have a \ inserted before them.
> That's kind of trivial.

Fair enough, though I don't find inserting '\'' much harder
(particularly since there's already a function in our standard library
to do it)

>   | but shquote(3) already takes care of that case).
> 
> Once sh handles $' '  I would expect that shquote(3) will be enhanced
> to make use of it.   It makes sense, the results are better in the
> hard cases, and in the simple ones the only difference is the '$' at
> the start.

In a sense, the whole discussion is moot.  The implementation of 'mount
-p' should just use shquote(3) (we don't want a proliferation of
slightly-incompatible quoting implementations).  As and when $'
gets implemented in both /bin/sh and shquote(3) the output format will
be upgraded as you suggest with no changes to the mount source code.

>   | Following Christos' suggestion, the assignment statements are
>   | easy:
>   | 
>   | MY_MOUNTED_DEVICE=$(mount -F %d)
> 
> Sure (not exactly that I don't think, as without some arg to mount,
> you'd get all of them listed)

That's actually a problem, thanks for bringing it up.  You could have
the formatted-output facility emit quoted representations, but then it
wouldn't be able to represent the default output format (which is an
ugly sort of inconsistency).  

I'm off the net for the weekend, but I'll probably take a crack at this
next week.

--
IDL


Home | Main Index | Thread Index | Old Index