5

I have a CIFS mount on my PC and the ls command shows me a certain file is there:

[bf@localhost dirX]$ ls -la
total 4096
drwxr-xr-x. 2 bf bf      0 20 okt 09:12 .
drwxr-xr-x. 2 bf bf      0  5 sep 11:05 ..
-rwxr-xr-x. 1 bf bf    880 19 okt 17:44 WeirdFile
-rwxr-xr-x. 1 bf bf    880 19 okt 17:44 GoodFile

However, when trying to read from it (or save to it), it says the file doesn't exist:

[bf@localhost dirX]$ cat WeirdFile
cat: WeirdFile: No such file or directory

Trying to cat GoodFile does work.

I am having trouble with CIFS anyway since moving to Fedora 26 and having to force to version 2.1 in fstab. Main problem is bad performance (slow!), but this is just plain weird.

Update when remounting the share, the file is gone.

1
  • Have you tried: more *WeirdFile* ? Oct 20, 2017 at 8:25

2 Answers 2

2

A possible reason that that Weirdfile isn't really using ASCII characters in the name. If this is the case, if you type the file name it doesn't work, but if you use copy/paste it does (it can also work with command completion, depending on where the non-Ascii character is).

There are two possibilities for non-ASCII characters: * the non-ASCII character has a glyph which is identical to one in the latin alphabet (Cyrillic 'a', 'o', 'e' are typical) * the non-ASCII character is not visible (+U200B, non-breaking-zero-width-space, for instance).

Besides the copy/paste v.s. retype difference:

  • if you do ls suspisciousfile | wc -c, with all-ASCII the wc output will be just one more byte than you can count characters in the file name (due to final linefeed), if there are non-ASCII characters it will be longer.
  • with hexdump: ls suspisciousfile | hexdump -C will make any non-ASCII characters very obvious.

Example with a specially crafted filе (where the final е is actually a Cyrillic character:

enter image description here

1
  • 1
    I typed the filename using tab completion. And tried hexdump, nothing weird there. Oct 20, 2017 at 8:38
0

I had a log file from a vendor app that really threw me off.

Turns out its file name ended with a space.

Try cat *WeirdFile* to see if there's any non-printing chars

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.