News for hackers. Stuff that matters.
Re:What's New in POSIX 2024 by ykonstant on Tuesday October 29, 2024 @06:11AM (#41981965)
In academia, I get (and used to create) pdfs with names like:

"On the number of

associative foobars

of degree blah -

Johnson and Anderson.pdf"

all the time. It is very convenient for non-technical academics to have a descriptive file name, and to be able to see it entirely in the navigator they use newlines.

Re:What's New in POSIX 2024 by jodrellblank on Tuesday October 29, 2024 @08:04AM (#41983010)
I don't know who "the Austin Group" mentioned in the article are, but how come they "could not find a single use-case for newlines in pathnames besides breaking naive scripts" when legitimate use-cases are so easy to find?

(And if they're that incompetent, why does the article imply they are worth quoting and listening to?)

Re:What's New in POSIX 2024 by gpderetta on Tuesday October 29, 2024 @09:22AM (#41983601)
It is [1] the joint working group that for the last 25+ years has been responsible for both the POSIX standard and the Single Unix Specification. It emerged after the UNIX wars as a consolidation of the various splintered UNIX standardization efforts (POSIX itself, X/OPEN, OSF, etc).

[1] https://en.wikipedia.org/wiki/Austin_Group

Re:What's New in POSIX 2024 by nilamo on Tuesday October 29, 2024 @11:01AM (#41984528)
Is that legitimate? A path name is just a unique identifier for a file, IMO it doesn't make sense to put a whole novel in there. If anything, a giant summary like that should be in the meta tags?
Re:What's New in POSIX 2024 by jodrellblank on Tuesday October 29, 2024 @01:02PM (#41986621)
In what way is it not legitimate? It's not an accident, bug or data corruption. Someone put it there for a reason, and it benefits their use case. That's as legitimate as it gets.
Re:What's New in POSIX 2024 by ykonstant on Tuesday October 29, 2024 @03:19PM (#41988321)
That's a core part of the problem: a path name is NOT just a unique identifier for a file. Desktop operating systems and their classical utilities conflate the "unique identifier" and whatever "displayed title" of a file though which the end user interacts with the file.

Users care about "titles" or "summaries" of files, not "filesystem identifiers"; as long as the two are conflated, non-technical users will use the identifier to write titles and thus make the file easy to locate in an interactive GUI. Meta tags are not even in the cognitive horizon of most people.

Re:What's New in POSIX 2024 by shthed on Thursday October 31, 2024 @05:55PM (#42011968)
Name one legit use case.
Re:What's New in POSIX 2024 by jodrellblank on Thursday October 31, 2024 @07:00PM (#42012409)
... the use case in the parent comment I was replying to.

And no I'm not going to copy that here for you to quip "that's not a legitimate use case". Make an effort to make a point and support it with better justification than "because I said so".

Re:What's New in POSIX 2024 by oneeyedpigeon on Tuesday October 29, 2024 @06:18AM (#41982044)
Oh god. I already get upset enough by spaces in a file name, although I realise that fight is basically lost now!
Re:What's New in POSIX 2024 by curt15 on Tuesday October 29, 2024 @07:23AM (#41982730)
Didn't Windows name "Program Files" with a space to force application developers to handle spaces in paths properly?
Re:What's New in POSIX 2024 by ape4 on Tuesday October 29, 2024 @08:18AM (#41983109)
Not to mention C:\Program Files (x86)
Re:What's New in POSIX 2024 by account42 on Tuesday October 29, 2024 @08:32AM (#41983215)
And C:\Programme and other localized variants to force people to go through the proper APIs instead of hardcoding paths.
Re:What's New in POSIX 2024 by pjmlp on Tuesday October 29, 2024 @08:37AM (#41983249)
In theory yes, in practice to this day many people don't bother how to learn how to deal with pathnames in a proper way.
Re:What's New in POSIX 2024 by inetknght on Tuesday October 29, 2024 @09:38AM (#41983726)
Top difficulties in computer science:

1. naming things

2. cache coherency

3. off-by-one errors

???

4. quoting pathnames

Re:What's New in POSIX 2024 by hawski on Tuesday October 29, 2024 @12:18PM (#41985880)
I would replace 4 with parameter expansion rules.
Re:What's New in POSIX 2024 by nneonneo on Tuesday October 29, 2024 @10:05AM (#41983965)
Eh, maybe. In practice I usually do all my moderately-heavy filesystem scripting in Python these days, for which pathname quoting is just a complete non-issue. Of course, I still use a shell for quick-and-dirty stuff, but usually only for pretty simple tasks where the simplest quoting setup ("$i") suffices.
Re:What's New in POSIX 2024 by mmcdermott on Tuesday October 29, 2024 @12:04PM (#41985632)
For the longest time you could get away with this in cmd:

> dir c:\progra~1

So if forcing people to handle spaces was the goal, it took a long time to force it.

Re:What's New in POSIX 2024 by arp242 on Tuesday October 29, 2024 @12:50PM (#41986435)
I'm pretty sure that still works. I forgot the exact scenario, but my Windows CI on GitHub Actions output shorte~1 pathna~1 like that in a script just a few months ago. On one hand, the backwa~1 compati~1 is nice. On the other hand, there's just so much depreca~1 cruft that keeps popping up even on contemp~1 systems.
Re:What's New in POSIX 2024 by InfiniteRand on Tuesday October 29, 2024 @04:50PM (#41989244)
I just got used to installing things I need to interact with in a program into a folder named C:\workspace
Re:What's New in POSIX 2024 by enriquto on Tuesday October 29, 2024 @06:40AM (#41982277)
As a fellow spaces-in-filenames-hater, the fight is not lost. We are on the brink of winning it; it's just a mount option away!

While we cannot avoid that people hit the spacebar when writing a filename on a gui, this does not mean at all that the resulting filename itself need contain a plain space character. Those spaces can and should be transparently translated to non-breaking space characters at some point. Maybe by the gui itself, or more robustly by the filesystem. This would make everybody happy: gui users and naive shell script writers.

Re:What's New in POSIX 2024 by poincaredisk on Tuesday October 29, 2024 @06:54AM (#41982455)
>Those spaces can and should be transparently translated to non-breaking space characters at some point

Why? This just introduces more complexity and interoperability headaches for seemingly no reason.

Re:What's New in POSIX 2024 by enriquto on Tuesday October 29, 2024 @07:13AM (#41982667)
> Why?

In order to preserve the sacrosanct simplicity of naive shell scripts. Seems like a very noble goal to me.

The only unexpexted compexity arises when you want to deal with filenames having mixed spaces and nbsps. But I'd say that people who do that had it coming.

Re:What's New in POSIX 2024 by alexvitkov on Tuesday October 29, 2024 @07:53AM (#41982934)
If you want simple shell scripts to work, make an actually good shell language without all the footguns.

The filesystem is way more important than /bin/sh and and any complexity added there will trickle down to all programs, not just shell scripts.

It's not worth adding hacks on the FS to patch defects in poorly written shell scripts (which are being replaced en masse with python/nodejs/even weirder yaml files/systemd units/etc... anyways)

Re:What's New in POSIX 2024 by ksp-atlas on Tuesday October 29, 2024 @09:08AM (#41983483)
nushell uses real lists for things which means you don't need to care about seperators except when dealing with external system things
Re:What's New in POSIX 2024 by consteval on Tuesday October 29, 2024 @09:33AM (#41983690)
Whitespace in filenames in general is difficult to deal with. Many, maybe most, programs get it wrong. It's not just about shell scripts, many GUI programs fail to handle those files properly too.
Re:What's New in POSIX 2024 by alexvitkov on Tuesday October 29, 2024 @10:06AM (#41983978)
When GUI programs mishandle filenames with spaces, IME it's usually because they spawn a subshell in a naive way (system("rm " + filename)).

To mishandle spaces you have to split an input w/ filenames by whitespace, which is not that common of an operation outside of a shell.

Re:What's New in POSIX 2024 by InfiniteRand on Tuesday October 29, 2024 @04:52PM (#41989274)
My favorite file+space issues is spaces at the end of file names, especially when you copy and paste text, or text gets trimmed from an input box, or the person forgets to trim space from an input box...
Re:What's New in POSIX 2024 by nradov on Tuesday October 29, 2024 @11:21AM (#41984776)
The vast majority of Windows and MacOS programs get it right.
Re:What's New in POSIX 2024 by consteval on Wednesday October 30, 2024 @10:07AM (#41994971)
No, no they don't - you just don't notice when they get it wrong, and you also don't name your files stupid things (I imagine).

If you actually test this, you'll realize a ton of Windows programs get it wrong.

Also, in general this is a poor argument. The goal of Linux isn't to be as much like Windows as possible, because Windows sucks ass. Nobody in their right mind would use Linux if it was just Windows but, presumably, shittier. The entire appeal of Linux is that it isn't Windows, and it isn't MacOS.

Re:What's New in POSIX 2024 by arp242 on Tuesday October 29, 2024 @12:54PM (#41986507)
Eh? It's really not a bother in pretty much any programming language, and you don't really need to do anything special for it. I don't know any program that has any problems with it.

Even zsh has fixed this. It's just /bin/sh and bash that are annoying.

Re:What's New in POSIX 2024 by lifthrasiir on Tuesday October 29, 2024 @08:54AM (#41983360)
Simplicity doesn't always mean stupidity. The simple but functional shell that correctly handles whitespaces without much hassle was already available since 90s, namely rc which is also found in Plan 9. Adopting rc's string concatenator `^` in POSIXy shells shouldn't be too hard.
Re:What's New in POSIX 2024 by vbezhenar on Tuesday October 29, 2024 @07:01AM (#41982518)
Yep, works today:

    sh-3.2$ f='Hello world'
    sh-3.2$ echo $f
    Hello world
    sh-3.2$ for i in $f; do echo $i; done
    Hello
    world

    sh-3.2$ f='Hello\xC2\xA0world'
    sh-3.2$ echo $f
    Hello world
    sh-3.2$ for i in $f; do echo $i; done
    Hello world
Re:What's New in POSIX 2024 by stouset on Tuesday October 29, 2024 @07:47AM (#41982893)
Just always quote variable interpolation and you will never have problems.

    sh-3.2$ f='Hello world'
    sh-3.2$ echo "${f}"
    Hello world
    sh-3.2$ for i in "${f}"; do echo "${i}"; done
    Hello world
    sh-3.2$
Re:What's New in POSIX 2024 by chasil on Tuesday October 29, 2024 @10:35AM (#41984248)
It would be really nice if there was a mount option that would quietly remove spaces in filenames, or convert them to an underscore.

If I had it, I would use it today.

Re:What's New in POSIX 2024 by jonhohle on Tuesday October 29, 2024 @10:25AM (#41984168)
Convince (force?) your team to use make and soon everyone will forget spaces in file names are even a thing!
Re:What's New in POSIX 2024 by taneliv on Tuesday October 29, 2024 @10:58AM (#41984497)
My team already uses `make` but there's no reason for me to run it in my Downloads folders. File names in there are sometimes wild. Yet I expect command line tools to work with them. If they will cease to do so, I will have to start using non-POSIX variants of those tools, I guess.
Re:What's New in POSIX 2024 by Flimm on Tuesday October 29, 2024 @06:56AM (#41982468)
How do these non-technical academics even create a PDF file with a name like that?
Re:What's New in POSIX 2024 by ykonstant on Tuesday October 29, 2024 @07:11AM (#41982649)
Right click, rename, enter, enter, enter (until the entire file name is visible on the box)? That's how I did it when I used Windows.
Re:What's New in POSIX 2024 by zelphirkalt on Tuesday October 29, 2024 @07:24AM (#41982736)
Doesn't <enter> just confirm the typed input for the filename and finish the renaming? How does that insert newlines?
Re:What's New in POSIX 2024 by ykonstant on Tuesday October 29, 2024 @07:33AM (#41982794)
Shrug, I last used windows with Windows 7, so you are probably right. That being said, at least two of the students I am currently tutoring are on XP and one of my colleagues as well :D
Re:What's New in POSIX 2024 by pino82 on Tuesday October 29, 2024 @08:50AM (#41983328)
No, it was always this way.
Re:What's New in POSIX 2024 by ykonstant on Tuesday October 29, 2024 @09:01AM (#41983425)
Right, I just remembered the main way to create those filenames: open the pdf, select and copy the title, close, rename the file and paste from clipboard.
Re:What's New in POSIX 2024 by astroid on Tuesday October 29, 2024 @04:23PM (#41988941)
Yes - I just tested on Win10+11 because I thought "there is no way I didn't accidentally do something like this on accident... and I would have remembered seeing a new line in my file name when I made that mistake."

I just opened a folder in file explorer, clicked 'rename' and then tried the following combinations: Enter L Ctrl + Enter L Alt + Enter Win + Enter R Ctrl + Enter R Alt + Enter

None of them let me put new lines in the filename - it either did nothing, or 'closed' the rename view.

Re:What's New in POSIX 2024 by abenga on Tuesday October 29, 2024 @08:10AM (#41983059)
I don't know if this is a Linux thing, but when renaming a file, when I press enter, I apply the new name, the file manager doesn't add a newline.
Re:What's New in POSIX 2024 by ykonstant on Tuesday October 29, 2024 @09:54AM (#41983860)
I am interested in hearing the rationale for downvotes explicitly. I am describing a reality that exists and must be taken into account. Why are you downvoting?