On Fri, Oct 26, 2012 at 3:47 PM, Dr. Werner Fink <[email protected]> wrote:
> I had a customer which had reported that the ksh run into problem if
> the /tmp partition on his system had no space left due to a process
> gone wild:
>
>   Last login: Tue Oct 23 15:12:00 2012 from ...
>   /etc/profile: line 12: write to 1 failed [No space left on device]
>   /etc/profile: line 41: write to 1 failed [No space left on device]
>   /etc/profile: line 87: write to 1 failed [No space left on device]
>   /etc/profile: line 88: write to 1 failed [No space left on device]
>   /etc/profile: line 91: write to 1 failed [No space left on device]
>   /etc/profile: line 92: write to 1 failed [No space left on device]
>   /etc/profile: line 93: write to 1 failed [No space left on device]
>   /usr/bin/manpath: can't set the locale; make sure $LC_* and $LANG are 
> correct
>   /etc/profile: line 207: write to 1 failed [No space left on device]
>   /etc/profile[324]: .: line 606: write to 4 failed [No space left on device]
>
> also the ksh93u-2012-02-29 sometimes crash in src/cmd/ksh93/sh/subshell.c
> which seems to be fixed in current ksh.  Nevertheless IMHO the ksh should
> check not only if access is allowed in /tmp or /usr/tmp (which points to
> /var/tmp) but also if there is enough room left.  If no space is left on
> the temporary device it would be perfect to use pipe() as fallback for
> stdout.

Uhm... for which shell constructs would you like to use |pipe()| ?

> See the attached patch for a suggested solution.  The change in
> src/lib/libast/path/pathtemp.c uses statvfs() to check if the device
> has at least space of the sitze of one page left.  The change in
> src/lib/libast/sfio/sftmp.c use the /dev/shm tmpfs which is used for
> POSIX shared memory objects.  One could use shm_open()/shm_unlink()
> but the file descriptor then has FD_CLOEXEC set in its flags.

A different solution (since  /dev/shm is not portable) may be to probe
various locations for temporary files and check if there is space left
(e.g. /tmp (preferred because this is usually a ramdisk-like
filesystem on newer Unixes), /var/tmp and /usr/tmp (the traditional
location)) and check if at least a page (MMU default page size) is
available (a better algorithm may be 8*default_mmu_page_size) ... if
all locations do not have enough space then ksh93 should bail-out with
a fatal error...

----

Bye,
Roland

-- 
  __ .  . __
 (o.\ \/ /.o) [email protected]
  \__\/\/__/  MPEG specialist, C&&JAVA&&Sun&&Unix programmer
  /O /==\ O\  TEL +49 641 3992797
 (;O/ \/ \O;)
_______________________________________________
ast-developers mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-developers

Reply via email to