1

Using a wildcard/glob (at least * and ?) in bash causes an input/output error when there are no matches on a samaba cifs mount in Debain Jessie 8.2. On other filesystems, the expected No such file error is given.

The same samaba mount point on an archlinux box and has no io error. The Archlinux machine's mount.cifs understands mapposix. I suspect that mount.cifs on jessie does not allow/understand mapposix has something to do with this.

Is there away around io errors for *?


 ## works as expected on cifs mount from centos server
 ls /data/Luna1/*adfadf*
 # ls: cannot access /data/Luna1/*adfadf*: No such file or director


 ### unexpected io failure on osx mounted on debian
 mkdir /Volumes/Phillips/testdir

 ## no files match in empty directory: io error
 ls /Volumes/Phillips/testdir/*
 #  ls: reading directory /Volumes/Phillips/testdir/*: Input/output error

 ## glob matches, ls results
 touch /Volumes/Phillips/testdir/file
 ls /Volumes/Phillips/testdir/*
 #  /Volumes/Phillips/testdir/file

 ## glob matches, ls results
 ls /Volumes/Phillips/testdir/*il*
 # /Volumes/Phillips/testdir/file

 ## no files match: io error
 ls /Volumes/Phillips/testdir/*foobar*
 #  ls: reading directory /Volumes/Phillips/testdir/*foobar*: Input/output error

 # fails as expected
 ls /*filedoesnotexist*
 #  ls: cannot access /*filedoesnotexist*: No such file or directory

 ## zsh handles this correctly
 zsh -c "ls /Volumes/Phillips/*dne*"
 #  zsh:1: no matches found: /Volumes/Phillips/*dne*

System info:

cat /etc/debian_version 
   8.2  
dpkg -l cifs-utils 
   ii  cifs-utils     2:6.4-1      amd64        Common Internet File 


mount |grep cifs
//gromit/Luna1/ on /data/Luna1 type cifs (rw,relatime,vers=1.0,cache=strict,username=foranw,domain=GROMIT,uid=1000,forceuid,gid=1000,forcegid,addr=10.145.64.52,unix,posixpaths,serverino,nobrl,acl,rsize=61440,wsize=65536,actimeo=1)

//skynet/Phillips/ on /Volumes/Phillips type cifs (rw,nosuid,nodev,noexec,relatime,vers=1.0,cache=strict,username=lncd,domain=SKYNET,uid=1000,forceuid,gid=1000,forcegid,addr=10.145.64.109,file_mode=0755,dir_mode=0755,nounix,nobrl,rsize=61440,wsize=65536,actimeo=1)
Will
  • 161
  • 1
  • 5

1 Answers1

0

My current workaround is to touch a file that matches the glob to avoid an error

This works particularly well for FSL's bet where rm is called with a glob that matches nothing. Interestingly, it throws "directory exists" (when it does not) instead of IO error.

bet 002_mprage_hpf 002_mprage_hpf_brain -m -f 0.1
# /bin/rm: cannot remove '002_mprage_hpf_brain_tmp*': Is a directory.
[ $? -ne 0 ] && echo failed
# failed

vs

touch 002_mprage_hpf_brain_tmp_hackyhackhack
bet 002_mprage_hpf 002_mprage_hpf_brain -m -f 0.1
[ $? -ne 0 ] && echo failed
# $? == 0
Will
  • 161
  • 1
  • 5