[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: mkdir: cannot create directory ... : Invalid argument



On Mon 13 Feb 2023 at 01:44:15 (+0000), Albretch Mueller wrote:
> On 2/12/23, David Wright <deblis@lionunicorn.co.uk> wrote:
> > On Sun 12 Feb 2023 at 21:04:35 (+0000), Albretch Mueller wrote:
> >>
> >>  I thought the problem related the encoding of characters of the URL
> >> from which I was that string, but it is not the case. So, the problem
> >> seems to relate to a dot as the last character of the name of a
> >> subdirectory on Windows NT filesystems mounted by fuseblk. Is that the
> >> case? I had never heard of such thing.
> >
> > My goto page for this sort of thing is:
> >
> >   https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file
> >
> > which says:
> >
> >  “Do not end a file or directory name with a space or a period.
> >   Although the underlying file system may support such names,
> >   the Windows shell and user interface does not. However, it is
> >   acceptable to specify a period as the first character of a name.
> >   For example, ".temp".”
> 
>  Hmm! Technically speaking I wonder why that would be.

IIRC, if you go back far enough, 8.3 filenames (and 6.3 even earlier)
were actually stored as FILENAMEEXT; IOW, the dot was implied but not
stored. The volume label, LABELSTRING, was also eleven characters in
size, but had no dot added to it when displayed.

Consequently, the filename "ABCDEFGH." would be indistinguishable
from "ABCDEFGH",   and was disallowed.

BTW, I didn't bother to look at the code in your example because
I didn't see any relevance to the error/question. AFAICT you're
just trying to create a file (or directory) on different filesystems.
You don't need a load of shell toothpicks to demonstrate the problem.

>  The only way around the problem is using another filesystem or URL
> encoding the whole name when Microsoft doesn't like it, but at times
> you are squeezing away some time to code while you are at work where
> they only use MS crap, but they would grant you a WSL installation ...
>  I was also having those kinds of problems because I work on corpora
> research and we need to work with huge amounts of data, so as a way to
> keep tabs on "what came from where", I replicate the URLs locally as
> best as I can. I realize that idea wasn't as safe as I thought.

The obvious way to store your URLs safely is encoded, as shown at:

  https://www.w3schools.com/tags/ref_urlencode.ASP

Cheers,
David.


Reply to: