Menu

#46 smbnetfs may return wrong subsecond value in times

v1.0 (example)
open
None
5
2019-03-02
2019-01-11
No

The bug was found in Ubuntu 18.04 (smbnetfs version 0.6.1-1, libsmbclient version 2:4.7.6+dfsg~ubuntu-0ubuntu2.6).

Looks like smbnetfs does not check/set nanosecond portion of file times. Command ls may show different nanoseconds for the same file. Even worse it may show negative nanoseconds value which may choke other tools.

Test case:

andrey@localhost:~$ smbnetfs $HOME/local/net/smb -o auto_unmount
andrey@localhost:~$ touch ~/local/net/smb/test/testfile
andrey@localhost:~$ (cd ~/local/net/smb/test; ls -l --time-style=full-iso testfile)
-rw-r--r-- 1 andrey andrey 0 2019-01-11 12:45:36.000000016 +0500 testfile
andrey@localhost:~$ (fusermount -u $HOME/local/net/smb && smbnetfs $HOME/local/net/smb -o auto_unmount)
andrey@localhost:~$ (cd ~/local/net/smb/test; ls -l --time-style=full-iso testfile)
-rw-r--r-- 1 andrey andrey 0 2019-01-11 12:45:36.-1744751200 +0500testfile
andrey@localhost:~$ sleep 1000
andrey@localhost:~$ (cd ~/local/net/smb/test; ls -l --time-style=full-iso testfile)
-rw-r--r-- 1 andrey andrey 0 2019-01-11 12:45:36.-1409258640 +0500testfile
andrey@localhost:~$ (cd ~/local/net/smb/test; env LANG=C touch -r testfile /tmp/testfile)
touch: setting times of '/tmp/testfile': Invalid argument

P.S.
The root cause of the bug might be in broken libsmbclient, but I believe smbnetfs must provide workaround for this (return zero and write warning message to log)

Discussion

  • Mikhail Kshevetskiy

    probably fixed in upstream

     
  • Mikhail Kshevetskiy

    • assigned_to: Mikhail Kshevetskiy
     

Log in to post a comment.