0

I have the file with name /home/lenka/Translations/Ф-119-Д/заключение об аннулировании, исправлении и-или дополнении акта о гражданском состоянии_рум-русс.docx

echo -n "/home/lenka/Translations/Ф-119-Д/заключение об аннулировании, исправлении и-или дополнении акта о гражданском состоянии_рум-русс.docx" | wc -c shows 235.

But touch finished with error: touch: cannot touch '/home/lenka/Translations/Ф-119-Д/заключение об аннулировании, исправлении и-или дополнении акта о гражданском состоянии_рум-русс.docx': File name too long

Ideas?

UP that file is on the USB stick with NTFS, I'm trying to copy it to EXT4.

Best!

niXman
  • 9
  • 2
  • 1
    touch is such a small program, that I would just run strace touch ... and see what syscall is giving the issue. since the filesystem allows the file to exist, it is surprising that touch is complaining at all. – toppk Sep 06 '22 at 22:11
  • The output of the `mount` command might clarify any special file system or overlay limitations. – anx Sep 06 '22 at 22:34
  • @toppk the error occurs on `openat()`: `openat(AT_FDCWD, "/home/lenka/Translations/....docx", O_WRONLY|O_CREAT|O_NOCTTY|O_NONBLOCK, 0666) = -1 ENAMETOOLONG (File name too long)` – niXman Sep 07 '22 at 06:03
  • for `cp` it fails on `newfstatat()` for destination dir, but `newfstatat()` OK for source dir. (USB stick, NTFS) – niXman Sep 07 '22 at 06:41
  • "not sure about Windows, but on Linux touch ${(pl[128][\U10FFFF])} (zsh syntax) fails (ok with 127) so we can't create a 128 character filename if those characters are expressed on two 16bit words in UTF-16. So the max filename on NTFS is in between 127 and 255 characters, or between 255 and 510 bytes there it appears." From here https://unix.stackexchange.com/questions/619625/to-what-extent-does-linux-support-file-names-longer-than-255-bytes – gapsf Sep 07 '22 at 07:55
  • @niXman okay, so the ntfs driver you are using does not properly support the capabilities of the filesystem. I would try a couple things. first, try creating a filename of the same length, but only use us-ascii chars, see if that works. second, I would try mounting the usb stick under /a/ and see if access works with a shorter total path. lastly there is a new ntfs driver in the latest kernels (called "NTFS3"). switching to that driver may be helpful. – toppk Sep 07 '22 at 12:52

0 Answers0