Shell script Y2K compliance?

Shell script Y2K compliance?

Post by J.D. Baldw » Fri, 01 May 1998 04:00:00



Does anyone have any strategies / suggestions for verifying that shell
scripts are Y2K compliant?

I work at a site with a great many diverse Unix systems.  Obviously,
we have a lot of OS-level Y2K issues to deal with, but one that just
came up is the existence of a great many locally developed scripts,
all of which must be reviewed for Y2K compliance.

My initial strategy is to write a script that uses 'find' to locate
every shell script on the system, then grep for the string 'date' and
flag everything that results.  A sysadmin would then have to review,
manually, every use of 'date' in each such file found.  (Or at least
the ones that didn't obviously come with the OS itself, for purposes
of this segment of the compliance review.)

We already found a script (in our DNS-to-WINS export functionality,
developed locally) that added 1900 to the "yy" value to serialize
files.  Bad programmer, no Jolt!  This is the sort of thing I'm
looking for.

I really doubt we're going to find anything locally developed that
might have a 2000 leap year bug, so I'm not too worried about that.

I really can't think of anything but 'date' that would be found in any
shell script that might cause a problem.  And I can't think of any
good way to streamline this or to narrow down the list of files
returned by my search.

If anyone out there has dealt with this directly, or knows of a formal
methodology for addressing shell script compliance relatively
efficiently, or has any other thoughts along these lines, please let
me know.  Thanks in advance.
--
 From the catapult of J.D. Baldwin  |+| "If anyone disagrees with anything I

 _|70|___:::)=}-  for PGP public    |+| retract it, but also to deny under
 \      /         key information.  |+| oath that I ever said it." --T. Lehrer
***~~~~-----------------------------------------------------------------------

 
 
 

Shell script Y2K compliance?

Post by Peter Samuels » Sat, 02 May 1998 04:00:00



Quote:> I really can't think of anything but 'date' that would be found in
> any shell script that might cause a problem.  And I can't think of
> any good way to streamline this or to narrow down the list of files
> returned by my search.

Check use of touch(1), which allows you to set an arbitrary date for a
file with or without the century.

Check for filenames made from dates ("update_980223") ... but that
probably involves use of date(1), so you're already catching it.

Look carefully at any code that deals with, say, RCS trees, where a
script might try to compare times without use of time_t.

Watch for evidence that someone didn't know how to use find(1)'s
"-[acm]time" and used 'ls -l' instead, and tried to parse that.  (It
should get 4-digit years but it's worth a cursory look anyway -- there
are other weird bugs that happen when you do that.)

Don't remember for the life of me where it was but it seems some
version of Unix had a stat(1) that pretty-printed a file's inode (a
sugar-coated ls -l, shall we say) -- if you have something like that
available make sure it hasn't been abused....

All I can think of at 4:41 AM.

--
Peter Samuelson
<sampo.creighton.edu ! psamuels>

 
 
 

Shell script Y2K compliance?

Post by Ian Stirlin » Sat, 02 May 1998 04:00:00




:> I really can't think of anything but 'date' that would be found in
:> any shell script that might cause a problem.  And I can't think of
:> any good way to streamline this or to narrow down the list of files
:> returned by my search.

<snip good points>

Might also be worth a look at awk, in shell scripts,
for strftime and systime.
Probably perl too.

--
Ian Stirling.   Designing a linux PDA, see  http://www.mauve.demon.co.uk/
----- ******* If replying by email, check notices in header ******* -----
What a wonderfull world it is that has girls in it!     Robert A Heinlein.

 
 
 

1. Newbie question about Y2K compliance

Hi All,

        I've been tinkering with RedHat 5.0 and really liking it.  I haven't
been able to find any definitive info about how Linux in general and Red
Hat in particular fare with Year 2000 compliance.  Thanks in advance for
answering what is probably a very elementary matter.

-Jeff

2. Disable unuse port

3. FreeBSD Y2K compliance on non-compliant hardware

4. Power Saving Features

5. Y2K compliance

6. Error while executing ′PPP Manager′ (exit code: 255)

7. Y2K Compliance

8. terrible....

9. Y2K compliance of mktime

10. tcp wrappers y2k compliance.

11. Linux (Red Hat 5.1 and 5.2) Y2K compliance

12. Y2K Compliance's

13. Y2K Compliance of Digital Unix 4.0.b