Re: [gentoo-user] ls config file?

2016-02-02 Thread David Haller
Hello,

On Tue, 02 Feb 2016, Raffaele BELARDI wrote:
>Andrew Tselischev wrote:
>> On Tue, Feb 02, 2016 at 09:54:37AM +0100, Raffaele BELARDI wrote:
>>> The option that controls this is --quoting-style, so
>>> can alias 'ls' to include this option but was wondering if there is a
>>> global configuration file controlling such behaviour.
>>
>> There is no configuration file for ls(1), but we can still solve the
>> problem. It is free software, after all!
>>
>> Put the file fix.patch in /etc/portage/patches/sys-apps/coreutils-8.25/
>> and apply the following changes to the ebuild (in the function src_prepare):
>
>fantastic!
>
>but I think I'll stick with the alias approach ;-)

Whatever happened to LS_OPTIONS?

But:

# ltrace -e getenv ls >/dev/null
ls->getenv("QUOTING_STYLE")  = nil
ls->getenv("COLUMNS")= nil
ls->getenv("TABSIZE")= nil
ls->getenv("LS_BLOCK_SIZE")  = nil
ls->getenv("BLOCK_SIZE") = nil
ls->getenv("BLOCKSIZE")  = nil
ls->getenv("POSIXLY_CORRECT")= nil
ls->getenv("BLOCK_SIZE") = nil

And there we go:

$ for f in *; do echo ">>$f<<"; done
>>foo *" '
 bar*<<
>>foo *" ' bar*<<
>>foo" ' bar<<
>>more<<
$ QUOTING_STYLE=literal ls -1
foo *" '? bar*
foo *" ' bar*
foo" ' bar
more
$ QUOTING_STYLE=shell ls -1
'foo *" '\''? bar*'
'foo *" '\'' bar*'
'foo" '\'' bar'
more
$ QUOTING_STYLE=c ls -1
"foo *\" '\n bar*"
"foo *\" ' bar*"
"foo\" ' bar"
"more"
$ QUOTING_STYLE=escape ls -1
foo\ *"\ '\n\ bar*
foo\ *"\ '\ bar*
foo"\ '\ bar
more

Where and how you set QUOTING_STYLE (/etc/*, ~/.*) is up to you. Or
use an alias.

HTH,
-dnh, who consideres strace and ltrace as _basic_ tools ;)

-- 
Bored? Want hours of entertainment? Just set the initdefault to 6! Whee!



[gentoo-user] ls config file?

2016-02-02 Thread Raffaele BELARDI
After a recent update of coreutils to version 8.25, 'ls -l' started 
displaying names containing spaces enclosed in single quotes, e.g.:

drwxr-xr-x  6 belardi users 4096 May 21  2012 'Audio Libraries'
drwxr-xr-x  2 belardi users 4096 Jun 10  2014 Brochure

The option that controls this is --quoting-style, so 
--quoting-style=literal returns to the old behaviour (which I prefer). I 
can alias 'ls' to include this option but was wondering if there is a 
global configuration file controlling such behaviour.

thanks,

raffaele

Re: [gentoo-user] ls config file?

2016-02-02 Thread Andrew Tselischev
On Tue, Feb 02, 2016 at 09:54:37AM +0100, Raffaele BELARDI wrote:
> The option that controls this is --quoting-style, so 
> --quoting-style=literal returns to the old behaviour (which I prefer). I 
> can alias 'ls' to include this option but was wondering if there is a 
> global configuration file controlling such behaviour.

There is no configuration file for ls(1), but we can still solve the
problem. It is free software, after all!

Put the file fix.patch in /etc/portage/patches/sys-apps/coreutils-8.25/
and apply the following changes to the ebuild (in the function src_prepare):


--- old/sys-apps/coreutils/coreutils-8.25.ebuild2016-01-30 
15:56:16.0 +
+++ new/sys-apps/coreutils/coreutils-8.25.ebuild2016-02-02 
10:18:38.985961581 +
@@ -72,6 +72,8 @@
touch src/dircolors.h
touch ${@/%x/1}
fi
+
+   epatch_user
 }


Don't forget to regenerate the manifest

ebuild .../sys-apps/coreutils/coreutils-8.25.ebuild manifest

and recompile!


;-)
diff a/src/ls.c b/src/ls.c
--- a/src/ls.c
+++ b/src/ls.c
@@ -1581,7 +1581,6 @@ decode_switches (int argc, char **argv)
   if (isatty (STDOUT_FILENO))
 {
   format = many_per_line;
-  set_quoting_style (NULL, shell_escape_quoting_style);
   /* See description of qmark_funny_chars, above.  */
   qmark_funny_chars = true;
 }


Re: [gentoo-user] ls config file?

2016-02-02 Thread Andrew Tselischev
On Tue, Feb 02, 2016 at 10:47:04AM +, Andrew Tselischev wrote:
> [...]
> Don't forget to regenerate the manifest
> 
>   ebuild .../sys-apps/coreutils/coreutils-8.25.ebuild manifest
> 
> and recompile!
> [...]

I forgot to mention, that if you seriously want to take that approach,
you'd need to mirror coreutils' ebuilds in your own portage overlay. The
changes to the ebuild (and Manifest) will get overwritten next time you
sync the tree.



Re: [gentoo-user] ls config file?

2016-02-02 Thread covici
Neil Bothwick  wrote:

> On Tue, 2 Feb 2016 11:07:02 +, Andrew Tselischev wrote:
> 
> > I forgot to mention, that if you seriously want to take that approach,
> > you'd need to mirror coreutils' ebuilds in your own portage overlay. The
> > changes to the ebuild (and Manifest) will get overwritten next time you
> > sync the tree.
> > 
> 
> There's no need for that. Just create /etc/env/portage/sys-apps/coreutils
> containing
> 
> post_src_unpack() {
>   cd "${S}"
>   epatch_user
> }

Is it not /etc/portage/env instead?


-- 
Your life is like a penny.  You're going to lose it.  The question is:
How do
you spend it?

 John Covici
 cov...@ccs.covici.com



Re: [gentoo-user] ls config file?

2016-02-02 Thread Neil Bothwick
On Tue, 2 Feb 2016 11:07:02 +, Andrew Tselischev wrote:

> I forgot to mention, that if you seriously want to take that approach,
> you'd need to mirror coreutils' ebuilds in your own portage overlay. The
> changes to the ebuild (and Manifest) will get overwritten next time you
> sync the tree.
> 

There's no need for that. Just create /etc/env/portage/sys-apps/coreutils
containing

post_src_unpack() {
cd "${S}"
epatch_user
}


-- 
Neil Bothwick

WinErr 001: Windows loaded - System in danger


pgpHnza2dyZdh.pgp
Description: OpenPGP digital signature


Re: [gentoo-user] ls config file?

2016-02-02 Thread Raffaele BELARDI
Andrew Tselischev wrote:
> On Tue, Feb 02, 2016 at 09:54:37AM +0100, Raffaele BELARDI wrote:
>> The option that controls this is --quoting-style, so
>> --quoting-style=literal returns to the old behaviour (which I prefer). I
>> can alias 'ls' to include this option but was wondering if there is a
>> global configuration file controlling such behaviour.
>
> There is no configuration file for ls(1), but we can still solve the
> problem. It is free software, after all!
>
> Put the file fix.patch in /etc/portage/patches/sys-apps/coreutils-8.25/
> and apply the following changes to the ebuild (in the function src_prepare):
>

fantastic!

but I think I'll stick with the alias approach ;-)

raffaele

Re: [gentoo-user] ls config file?

2016-02-02 Thread Neil Bothwick
On Tue, 02 Feb 2016 06:55:31 -0500, cov...@ccs.covici.com wrote:

> > There's no need for that. Just
> > create /etc/env/portage/sys-apps/coreutils containing
> > 
> > post_src_unpack() {
> > cd "${S}"
> > epatch_user
> > }  
> 
> Is it not /etc/portage/env instead?

Of course it is. I was just checking if anyone was paying attention, as I
clearly was not.


-- 
Neil Bothwick

The best things in life are free, but the
expensive ones are still worth a look.


pgp6H74_GoqM1.pgp
Description: OpenPGP digital signature