Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
My (test) system is short of disk space, and sed is truncating the output file as a result. However, as can be seen below, sed does not return an error status, so how can I prevent this from happening silently on a live system, and corrupting files? Is this a Solaris bug?
rdds [RDDS] sed '' < long_file > long_file.out
rdds [RDDS] echo $?
0
rdds [RDDS] ls -l long*
-rw-rw---- 1 rdds pathway 60938046 Apr 15 09:27 long_file
-rw-rw---- 1 rdds pathway 49250304 Apr 15 10:19 long_file.out
rdds [RDDS] df -k .
Filesystem kbytes used avail capacity Mounted on
/dev/vx/dsk/rootdg/home
2031711 1948949 21811 99% /home

Well, I have a fairly complicated sed script which performs necessary reformatting of the file(s) prior to delivery to other parts of the system. We have tried implementing this using awk and PL/SQL (the file contents are from an Oracle database), but both have problems with line length (and PL/SQL with performance). So the sed solution seems simple, efficient and reliable, except for the disk space problem I am experiencing. The example I posted had a null sed script, to demonstrate that the size change is not due to any changes specified in the script.
If I just do 'cp long_file long_file.out' I get an error message and return value 2, but sed is not being so helpful.

I have now run a truss and it shows a load of write() calls failing with ENOSPC, but the sed process carrying on regardless. And the opensolaris sed source shows that all the putc() and most of the other file handling calls have no error checking whatsoever. Pretty poor, I would say.

![]() |
Disk problem
|
scp / ssh failing intermi...
|
| Login or Register to Reply | |
| Login | Register |
| Ads by Google |