File without any flags is not listed by ls
np422 opened this issue · 2 comments
Henlo!
A curious case, a file without any flags set won't be listed by the ls method of the sambal client.
Some of the information below have been redacted to protect the innocent.
smbclient -I prd-db-w01 -U XXXX YYYY .....
cd /some/strange/path
smb: \some\strange\path\ > ls
. D 0 Wed Nov 3 10:22:12 2021
.. D 0 Wed Nov 3 10:21:57 2021
ID_84389_7601003001921_211111012316880071_20211116164659941.pdf 166155 Wed Nov 17 16:40:46 2021
When using sambal in irb.
irb(main):001:0> require 'sambal'
irb(main):002:0> smb = Sambal::Client.new(domain: 'ZZZ', host: 'prd-db-w01', share: 'FS_PRD', user: 'XXX', password: 'YYY')
irb(main):003:0> smb.cd '/some/strange/path'
irb(main):004:0> smb.ls
=> {"."=>{:type=>:directory, :size=>"0", :modified=>2021-11-03 10:22:12 +0100}, ".."=>{:type=>:directory, :size=>"0", :modified=>2021-11-03 10:21:57 +0100}}
And after toggling the archive flag, using file explorer.
smb: \some\strange\path\> ls
. D 0 Wed Nov 3 10:22:12 2021
.. D 0 Wed Nov 3 10:21:57 2021
ID_84389_7601003001921_211111012316880071_20211116164659941.pdf A 166155 Wed Nov 17 16:40:46 2021
The response from the sambal client.
irb(main):005:0> smb.ls
=> {"."=>{:type=>:directory, :size=>"0", :modified=>2021-11-03 10:22:12 +0100}, ".."=>{:type=>:directory, :size=>"0", :modified=>2021-11-03 10:21:57 +0100}, "ID_84389_7601003001921_211111012316880071_20211116164659941.pdf"=>{:type=>:file, :size=>"166155", :modified=>2021-11-17 16:40:46 +0100}}
The behaviour is likely caused by the + sign on https://github.com/johnae/sambal/blob/master/lib/sambal/client.rb#L291
If this is the expected behaviour, please feel free to slap me with a dead trout and close the issue.
Additional information.
In my initial report above, the filesystem for the share connected to is a MSSQL server FileTable backed share.
The same behavior is present when the file flag is n
on a normal filesystem.
smbclient:
smb: \> ls
. D 0 Mon Dec 6 14:49:09 2021
.. D 0 Mon Dec 6 14:49:09 2021
asdf.txt n 0 Mon Dec 6 14:49:08 2021
When using sambal:
irb(main):007:0> smb.ls
=> {"."=>{:type=>:directory, :size=>"0", :modified=>2021-12-06 14:49:09 +0000}, ".."=>{:type=>:directory, :size=>"0", :modified=>2021-12-06 14:49:09 +0000}}