*BSD News Article 16427


Return to BSD News archive

Path: sserve!newshost.anu.edu.au!munnari.oz.au!constellation!osuunx.ucc.okstate.edu!moe.ksu.ksu.edu!zaphod.mps.ohio-state.edu!swrinde!news.dell.com!uudell!obiwan!bob
From: bob@obiwan.uucp (Bob Willcox)
Newsgroups: comp.os.386bsd.bugs
Subject: Minor bug in ls (timezone related) with patch
Message-ID: <C7IAxB.HD@obiwan.uucp>
Date: 24 May 93 01:03:10 GMT
Organization: Bob's Place, Austin TX
Lines: 44

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.


*** /tmp/,RCSt1000238	Sun May 23 19:34:31 1993
--- ls.c	Sun May 23 19:33:17 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,249 ----
  	    (f_longform || f_listdir || f_type || f_recursive) && !f_ignorelink ? lstat : stat;
  
  	if (!argc) {
! 		static char *nargv[2] = {".", NULL};
! 		static int  nargc = 1;
  
! 		doargs(nargc, 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)