[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#511342: does not check for file creation errors



Package: devtodo
Version: 0.1.19-3
Severity: grave
Justification: causes data loss

Here's how to reproduce:

| mowsiany@beczulka:/$ strace -t -o /tmp/tda-write-fail.log tda
| Enter text for the item you are adding.
| text> foo
| 1. veryhigh   2. high   3. medium   4. low   5. verylow   
| Enter a priority from those listed above.
| priority> medium
| Index of new item is 1
| todo: warning, created database (.todo) has group or world permissions
| mowsiany@beczulka:/$ echo $?
| 0
| mowsiany@beczulka:/$ ls -l .todo
| ls: .todo: No such file or directory
| mowsiany@beczulka:/$ 

Here's the relevant snippet from the strace log:

| 18:44:52 write(1, "\33[0m\33[32mIndex of new item is 1\33"..., 36) = 36
| 18:44:52 open(".todo", O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0666) = -1 EACCES (Permission denied)
| 18:44:52 stat64(".todo", 0xbfe0b304)    = -1 ENOENT (No such file or directory)
| 18:44:52 write(2, "todo: warning, created database "..., 33) = 33
| 18:44:52 write(2, ".todo", 5)           = 5
| 18:44:52 write(2, ") has group or world permissions", 32) = 32
| 18:44:52 write(2, "\n", 1)              = 1
| 18:44:52 exit_group(0)                  = ?

Clearly the exit status nor the message do not reflect the fact that creating
the file failed, though apparently the program does pay attention to the fact
that open() failed, as there is no write() call visible.

Apart from the above, it would be good to check if the program correctly
detects write(), flush() and close() failures (e.g. when filesystem runs out of
space).

-- 
Marcin Owsiany <porridge@debian.org>             http://marcin.owsiany.pl/
GnuPG: 1024D/60F41216  FE67 DA2D 0ACA FC5E 3F75  D6F6 3A0D 8AA0 60F4 1216



Reply to: