reopen 338898
tags 338898 +patch
thanks

Michael Stone wrote:
> On Sun, Nov 13, 2005 at 11:30:47AM -0500, Anthony DeRobertis wrote:

> Umm, or you could set the environment variable in your systemwide
> startup scripts. man dircolors.

Excerpt from /etc/skel/.bashrc:

# enable color support of ls and also add handy aliases
if [ "$TERM" != "dumb" ]; then
    eval "`dircolors -b`"
    alias ls='ls --color=auto'
    #alias dir='ls --color=auto --format=vertical'
    #alias vdir='ls --color=auto --format=long'
fi

So just adding it to e.g., /etc/bash.bashrc won't work (unless you edit
every user's bashrc file).

I've attached a patch which seems to work.
diff -NrdbU3 coreutils-5.2.1/debian/patches/32_dircolors.conf.diff coreutils-5.2.1.new/debian/patches/32_dircolors.conf.diff
--- coreutils-5.2.1/debian/patches/32_dircolors.conf.diff	1969-12-31 19:00:00.000000000 -0500
+++ coreutils-5.2.1.new/debian/patches/32_dircolors.conf.diff	2005-11-13 12:11:10.000000000 -0500
@@ -0,0 +1,45 @@
+diff -Nru3 ./coreutils-5.2.1/src/dircolors.c ../build-tree.new/coreutils-5.2.1/src/dircolors.c
+--- ./coreutils-5.2.1/src/dircolors.c	2004-01-21 17:27:02.000000000 -0500
++++ ../build-tree.new/coreutils-5.2.1/src/dircolors.c	2005-11-13 12:04:16.000000000 -0500
+@@ -375,7 +375,7 @@
+ }
+ 
+ static int
+-dc_parse_file (const char *filename)
++dc_parse_file (const char *filename, int ignore_open_fail)
+ {
+   FILE *fp;
+   int err;
+@@ -394,6 +394,10 @@
+       fp = fopen (filename, "r");
+       if (fp == NULL)
+ 	{
++	  if (ignore_open_fail)
++	    {
++	      return -1;
++	    }
+ 	  error (0, errno, "%s", quote (filename));
+ 	  return 1;
+ 	}
+@@ -500,9 +504,13 @@
+ 
+       obstack_init (&lsc_obstack);
+       if (argc == 0)
+-	err = dc_parse_stream (NULL, NULL);
++      	{
++	  err = dc_parse_file("/etc/dircolors.conf", 1);
++	  if (-1 == err)
++	    err = dc_parse_stream (NULL, NULL);
++	}
+       else
+-	err = dc_parse_file (argv[0]);
++	err = dc_parse_file (argv[0], 0);
+ 
+       if (!err)
+ 	{
+@@ -533,3 +541,5 @@
+ 
+   exit (err == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
+ }
++
++/* vim: set ts=8 sw=2: */
diff -NrdbU3 coreutils-5.2.1/debian/rules coreutils-5.2.1.new/debian/rules
--- coreutils-5.2.1/debian/rules	2005-11-13 12:26:05.000000000 -0500
+++ coreutils-5.2.1.new/debian/rules	2005-11-13 12:23:21.000000000 -0500
@@ -89,6 +89,10 @@
 		mv $(d)/usr/bin/$$f $(d)/bin/$$f; \
 	done
 	
+	# make conffile for dircolors
+	mkdir $(d)/etc
+	$(d)/usr/bin/dircolors -p > $(d)/etc/dircolors.conf
+	
 	# dpkg contains its own md5sum (grrr)
 	mv $(d)/usr/bin/md5sum $(d)/usr/bin/md5sum.textutils
 	mv $(d)/usr/share/man/man1/md5sum.1 $(d)/usr/share/man/man1/md5sum.textutils.1

Reply via email to