*BSD News Article 16490


Return to BSD News archive

Path: sserve!newshost.anu.edu.au!munnari.oz.au!news.Hawaii.Edu!ames!elroy.jpl.nasa.gov!swrinde!news.dell.com!uudell!obiwan!bob
From: bob@obiwan.uucp (Bob Willcox)
Newsgroups: comp.os.386bsd.bugs
Subject: Re: Minor bug in ls (timezone related) with patch
Message-ID: <C7Kzuy.2Gz@obiwan.uucp>
Date: 25 May 93 11:56:58 GMT
References: <C7IAxB.HD@obiwan.uucp>
Organization: Bob's Place, Austin TX
Lines: 51

In article <C7IAxB.HD@obiwan.uucp> bob@obiwan.uucp I wrote:
>I discovered that whenever I listed a directory with a simple "ls -l"
>(no arguments) command that the timestamps of the files were listed as
>though I was in the Pacific timezone.  After looking through the ls.c
>code I discovered that it would alter argc and argv in the default case
>(no arguments) to appear as though there was exactly one argument of
>".".  Unfortunately this seems to hose up the environment.  Below is a
>patch of what I changed on my sytem to fix it.

Well, as fate would have it, the patch had a problem which results in
a coredump when doing something like "ls -ld" (-d option w/o arguments).

Below is a fixed patch:

*** /tmp/,RCSt1000755	Tue May 25 06:49:36 1993
--- ls.c	Tue May 25 06:45:47 1993
***************
*** 238,250 ****
  	    (f_longform || f_listdir || f_type || f_recursive) && !f_ignorelink ? lstat : stat;
  
  	if (!argc) {
! 		static char dot[] = ".";
  
! 		argc = 1;
! 		argv[0] = dot;
! 		argv[1] = NULL;
! 	}
! 	doargs(argc, argv);
  	exit(0);
  }
  
--- 238,251 ----
  	    (f_longform || f_listdir || f_type || f_recursive) && !f_ignorelink ? lstat : stat;
  
  	if (!argc) {
! 		char	    narg[2];
! 		static char *nargv[2] = {NULL, NULL};
  
! 		strcpy(narg, ".");
! 		nargv[0] = narg;
! 		doargs(1, nargv);
! 	} else
! 		doargs(argc, argv);
  	exit(0);
  }
  

-- 
Bob Willcox                ...!{rutgers|ames}!cs.utexas.edu!uudell!obiwan!bob
Phone: 512 258-4224 (home)
       512 838-3914 (work)