Article View: comp.unix.shell
Article #139Re: noclobber
From: James J. Yorton
Date: Fri, 24 Jul 1992 14:01
Date: Fri, 24 Jul 1992 14:01
54 lines
2875 bytes
2875 bytes
In article <91773@bu.edu>, tesco@bumetb.bu.edu (Dances With Babes) writes: |> Does anyone know if the "set -o noclobber" command is atomic? |> I'm trying to implement a semaphore in ksh, and this would be a good way, |> provided it's atomic (that it, no two people can create the file at the same time). |> |> If it's not atomic, anyone know of a good way |> to implement a semaphore using ksh? |> |> |> -tesco Sorry I don't have the answer to your specific question. But before people go off and try doing things with "set -o noclobber", I wanted to let people know there is a bug with "set -o noclobber" in the latest release of ksh from the Toolchest (ksh88g), at least on some systems, specifically mine (Sun OS 4.1.1). In a phrase, it doesn't work. It's as if you have noclobber disabled, even though set -o shows it's enabled, so overwriting a file with > redirection silently overwrites that file. I passed my findings on to David Korn and here was his response: : Date: Wed, 8 Apr 92 23:39:33 EDT : : This is a serious problem. The code uses POSIX style : macros to test file attributes. However, since the type : field for regular files can be zero, my code can't : distinguish between files that don't exist and regular : files. : : I will have to put together an 'h' point release for : release very soon. : : Thanks for reporting the problem. It looks as if : most people do not use noclobber or else the problem : would have been reported sooner. : If you're not running ksh88g you should be OK as the problem is NOT present in previous releases of ksh from the Toolchest. The Toolchest says the latest release is still 88g and said ksh-92 is coming. No mention of ksh88h yet. If anyone knows what's going on with 88h, let me know or post it. Thanks. --------------------------------------+--------------------------------------- Jim Yorton | Telephone: +1 708-632-6695 Motorola Inc., General Systems Sector | Cellular Infrastructure Group | internet: yorton@rtsg.mot.com 1501 - West Shure Drive | uucp: ...!uunet!motcid!yorton Mail Drop: IL27-3227 | Arlington Heights, IL 60004 | USA |
Technical Details
Message-ID:
<1992Jul24.140107.8004@rtsg.mot.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!ftpbox!motsrd!white!sapphire.rtsg.mot.com!motcid!yortonReferences:
<1992Jul21.070212.16485@gbrmpa.gov.au> <1992Jul22.014834.1384@jpradley.jpr.com> <1992Jul23.191928.4948@walter.bellcore.com> <91773@bu.edu>Show Full Headers
Complete Article Headers
Newsgroups: comp.unix.shell Path: arc1-ca.pugleaf.net!sparky!uunet!ftpbox!motsrd!white!sapphire.rtsg.mot.com!motcid!yorton From: yorton@turtle11.rtsg.mot.com (James J. Yorton) Subject: Re: noclobber Message-ID: <1992Jul24.140107.8004@rtsg.mot.com> Sender: news@rtsg.mot.com Nntp-Posting-Host: turtle11 Reply-To: yorton@rtsg.mot.com Organization: Motorola Inc., Cellular Infrastructure Group References: <1992Jul21.070212.16485@gbrmpa.gov.au> <1992Jul22.014834.1384@jpradley.jpr.com> <1992Jul23.191928.4948@walter.bellcore.com> <91773@bu.edu> Date: Fri, 24 Jul 1992 14:01:07 GMT Lines: 54