[ / / / / / / / / / / / / / ] [ dir / animu / hispint / hwndu / lgbt / litpat / vg / vichan / vv ][Options][ watchlist ]

/tech/ - Technology

You can now write text to your AI-generated image at https://aiproto.com It is currently free to use for Proto members.
Name
Email
Subject
Comment *
File
Select/drop/paste files here
Password (Randomized for file and post deletion; you may also set your own.)
* = required field[▶ Show post options & limits]
Confused? See the FAQ.
Expand all images

File (hide): 05848222ff059b0⋯.jpg (61.44 KB, 1040x690, 104:69, unix meme.jpg) (h) (u)

[–]

 No.921120>>921196 >>921542 >>921659 >>921660 >>921676 >>921739 >>922539 >>922582 >>927227 >>927244 [Watch Thread][Show All Posts]

Can we please talk about how UN*X shell is still not fixed in 2018?

All they need to do is add "path" and "flag" data types separate to strings. Currently in shell everything is a string and it breaks everything.

 No.921122>>921136 >>922150 >>927001

>Currently in shell everything is a string and it breaks everything.

how many servers are you responsible for?


 No.921136


 No.921152

what shell?


 No.921158>>921373

You're complaining about fundamental Unix limitations, not about the shell. Good luck fixing that without throwing out everything.


 No.921159

You're too retarded to see the real problem. What would fix POSIX would be to standardize a simple format for tabular and tree data. For tabular, simply use RS and FS variables (also, forbid ASCII FS..US in filenames), for trees, I don't know what would be best, but something even simpler than JSON would be appreciable.


 No.921167>>921182 >>921303 >>921703

UNIX can't be fixed. UNIX has the same problems it had in the 70s and 1991 except now the shills are better at tricking users into not realizing they are problems.

Date: Fri, 1 Mar 91 14:27:50 -0800
Subject: A Joke In Every Sentence

In a fit of work avoidance, I just flipped open a copy of
The Sun Observer, and read the following from a ``helpful
hints'' type column. It is NOT A JOKE.

Using noclobber and read only files only protects you
from a few occasional mistakes. A potentially
catastrophic error is typing

rm * .o

instead of

rm *.o

In the blink of an eye, all of your files would be gone.
A simple yet effective preventive measure is to create a
file called -i in the directory in which you want extra
protection:

touch ./-i

In the above case, the * is expanded to match all of the
filenames in the directory. Because the file -i is
alphabetically listed before any file except those that
start with the character: !#$ percent&`()*+,. The rm
command sees the -i file as an argument. When rm is
executed with the -i argument, files will not be deleted
unless you verify the action.

This still isn't perfect. If you have a file that starts
with a comma in the directory, it will come before the
file starting with a dash and rm will not get the -i
argument. SunOS's make utility creates file starting
with a comma if the make file understands hidden
dependencies by having the following line in the make
file:

.KEEP-STATE:

The -i file also won't save you from errors like

rm [a-z]* .o

The bit about files that appear before -i is garbled in the
original. I blame nroff.


 No.921182>>921278

>>921167

>advocating handholding unrionically

Go use Windows, faggot. Your retarded quote made by a retard doesn't even relate to the thread. Also, nobody wants to discuss with an autist confusin philosophy and implementation (inb4 not handling errors and all this bullshit are part of the philosophy, they're not).


 No.921196>>921224 >>921496

File (hide): 5748b4880f5527f⋯.png (548.78 KB, 1200x756, 100:63, comfy windows.png) (h) (u)

>>921120 (OP)

>using *nix

>in 2018

Sad. Many such cases!


 No.921224

>>921196

>Windows 10

>not Windows Server 2016

You are a superpleb.


 No.921249>>921262

There is only one flaw in Unix shells.

zfs destroy or zpool destroy.

Pretty easy to fix though, just write a wrapper that provides verification for the destroy command.


 No.921262

>>921249

>There is only one flaw in Unix shells.

>zfs destroy or zpool destroy.

How is this related to sh?


 No.921278

>>921182

True Unix has never been tried.


 No.921279

>can't even safely do echo "$a" without it fucking up for some values of $a

UNIX was a mistake.


 No.921283>>921288 >>921373 >>921677

>ITT: linux is bash

>ITT: unix is bash

>ITT: *nix is bash

You guys do know other shells exist, right?


 No.921288

>>921283

Is bash the only shell that has these problems?


 No.921303>>921310 >>921319

>>921167

That's pretty clever failsafe for important dirs.

I wouldn't call it an issue, who names their files with a starting - anyway?


 No.921310>>921318

>>921303

who names their files starting with a . ... oh wait like half my home directory.

>clever

Watch as I transform a bug into a feature.


 No.921318>>921320 >>922365

>>921310

Who doesn't pay attention to what they're about to do before hitting Enter on an "rm" command?

Oh wait retards.


 No.921319

>>921303

see OP pic


 No.921320>>921321

>>921318

>implying it's only rm


 No.921321>>921323

File (hide): 7f067789d1686d8⋯.jpg (50.14 KB, 1000x559, 1000:559, Aaaaah.jpg) (h) (u)

>>921320

Yes, there is more than one command where you should pay attention to what you fucking typed before hitting enter. Computers are not supposed to be used by goldfish that can only remember one thing.


 No.921323>>921373

>>921321

Does your editor warn you when you try to exit without saving?


 No.921373>>921432 >>922203

>>921158

Shell is a thin wrapper around fork and exec. Exec/c don't have this problem, args wil be passed to the process unsplit.

>>921283

There are certain requirements for something to be a POSIX shell. Same goes for unix. Unquoted vars being split on $IFS is one of those things

>>921323

Not him, but vim wont let you :quit an unsaved buffer. You can still ZQ or :q! without trouble though.


 No.921432>>921569

>>921373

Passing unsplit strings to a process is doable even in bourne sh, if unnecessarily tedious.

Telling the process which arguments are flags and which ones aren't (the topic of this thread) is impossible to do consistently. Not all software supports the -- separator.


 No.921488

sudo apt-get install -y powershell

Or, like, use Python.


 No.921496>>921511

>>921196

>open source a bad thing

>implying all linux users use a shit unstable distro like arch

>amd drivers literally preform better on linux

>implying winshit's init is better than systemd and implying we're forced to use it

>minimal googling

>googling

jesus you're retarded


 No.921511>>927042

>>921496

>open source

<undocumented, unfinished, obsolete dependencies, works-for-me, project abandonment

<ie, you get what you pay for

>implying Ubuntu will save you from xorg.conf

>amd

<except when proprietary driver is deprecated and it takes 1 full year for the open source stack to increment its OpenGL version

<can't use superior NVIDIA product

<freedom is slavery

>systemd

<implying there's anything wrong with systemd

<taking the bait this hungrily


 No.921517

the virgin linux loser

-must have autistic colors for the few cli programs he uses

-complains when distros dont add user to sudoers by default

-thinks i3 + vim makes him look cool

-would use a systemd distro if it wasn't uncool

-unironically compiles everything from source

-bloated core components

-doesn't care about his package manager as long as it has dependency resolution

THE CHAD BSD BEASTIE

-has disabled colors from appearing on his system

-runs everything as root. fears nothing

-"yeah, i'd use dwm if it weren't so bloated"

-doesn't have to worry about an init being sane, they all are

-thanks god each day for binary package management

-minimal, fast core components. starts an hour long rant in irc when his system doesn't boot in less than 3 seconds

-urges devs to make a back-end package manager with no dependency resolution and to make it the default package manager


 No.921542>>921546 >>921551 >>921552 >>921633

>>921120 (OP)

> Can we please talk about how UN*X shell is still not fixed in 2018?

Yes, it is, and that's by design. Being able to write shell scripts is just a convenience for gluing simple things together. If you need a more powerful scripting system then use a proper scripting language:

#!/usr/local/bin/guile -s
!#

(system* "touch" "look ma, spaces.txt")

From the documentation:

- Scheme Procedure: system* .  args
Execute the command indicated by ARGS. The first element must be a
string indicating the command to be executed, and the remaining
items must be strings representing each of the arguments to that
command.

This function returns the exit status of the command as provided by
`waitpid'. This value can be handled with `status:exit-val' and
the related functions.

`system*' is similar to `system', but accepts only one string
per-argument, and performs no shell interpretation. The command is
executed using fork and execlp. Accordingly this function may be
safer than `system' in situations where shell interpretation is not
required.

Example: (system* "echo" "foo" "bar")


 No.921546

>>921542

BTW, system* will also not carry out shell expansion, so

(system* "rm" "*")

Will actually try to delete the file named '*' and if it doesn't exists it will throw an error:

scheme@(guile-user)> (system* "rm" "*")
rm: *: No such file or directory
$1 = 256

You can use 'system' (without the asterisk at the end) if you really want to expand wildcards. It's all about choosing the right tool for the job.


 No.921551>>921656

>>921542

That's not the problem this thread complains about. Try:

#!/usr/local/bin/guile -s
!#
(system* "touch" "-foo")

This problem lies deeper than the shell.


 No.921552>>921562

>>921542

(Not to mention that sh has no trouble with 'touch "look ma, spaces.txt"' so you haven't demonstrated anything sh can't trivially do, even though guile offers plenty)


 No.921562

>>921552

You have to fight the shell to get what Guile (or any other scripting language) gives you for free. Yes, you could put quotation marks around the file name, but what if instead of a fixed file name you splice in the output of another command? As shell scripts grow more complex you have to write them more defensively. I use a linter, so I find most of the obscure details before the code even runs, but just look at all this shit (the rules SCxxxx):

https://github.com/koalaman/shellcheck/wiki


 No.921569>>921575

>>921432

Only the shell have to support it and bash do it in the right way.


 No.921575>>921592 >>922361 >>922508

>>921569

No.

Run "touch -foo". Notice that it doesn't create a file named -foo. You have to use "touch -- -foo".

Now install jpegoptim and make a JPG file called -foo.jpg. Run "jpegoptim -foo.jpg" and "jpegoptim -- -foo.jpg". Notice that neither work.


 No.921592>>921602

>>921575

jpegoptim "-foo.jpg"


 No.921602>>921603

>>921592

You don't understand how shells work.

Quotes are for the shell's convenience. They don't get passed to the process,


 No.921603>>921608

>>921602

okay, but does it work


 No.921608

>>921603

No.

If you want to gain an understanding of what processes can and can't see, play around with passing arguments to this Python script:

#!/usr/bin/env python3
import sys
print(sys.argv)

It's very simple, if unexpected to beginners.


 No.921630>>922183

>ITT: Why can't I name my file "sudo rm -rf /" UNIX is shit!


 No.921633>>921656 >>921662

>>921542

So lisp has a list data type and that lets you work with spaces correctly

but you still have the problem of paths whose name starts with -. Since it to shell itself they're all just strings.

You'd need to go deeper to fix this. it can't be repaired just by making a better way to call system.


 No.921656>>921664

>>921633

>>921551

Yeah, you're right. I was mostly looking at the OP pic and how it's a non-issue when using a scripting language. The only real solution for this is to forget about the shell and use system calls through a scripting language's FFI.


 No.921659

>>921120 (OP)

>complaining about spaces

Try single quotes or percent signs.


 No.921660>>921797

>>921120 (OP)

How fucking hard Is it to add quotes, you fucking mong?


 No.921662

>>921633

>You'd need to go deeper to fix this.

int execv(const char *path, char *const argv[]);

Look at that shit.


 No.921664

>>921656

A solution is to specify a new ENV-based protocol. Let executables signal that they support it, in which case options can be passed in through environment variables prefixed with OPT.

It's a gigantic hack, but it gives you proper key-value pairs.


 No.921676>>921678 >>921723 >>921740 >>921798

>>921120 (OP)

God I hate you "Unix" fuckheads. Unix was a proprietary system 50 years ago, no sane person is using it anymore.


 No.921677>>922185

>>921283

Bash is the shell of the GNU operating system.


 No.921678>>921695

>>921676

Unix is also a rough standard that's used as the basis of a distressingly large share of widely used operating systems.

Which name would you use for this occasion?


 No.921695

>>921678

unix-like


 No.921703

>>921167

Just alias rm as rm -i


 No.921723

>>921676

>Unix was a proprietary system 50 years ago, no sane person is using it anymore.

Mac OS X users are often obnoxious, but I've never had any reason to question their sanity.

https://www.opengroup.org/openbrand/register/


 No.921739

>>921120 (OP)

UN*X shell is unfixable nigger. adding two types isn't gonna fix shit (will it will fix 1/10000000 problems)


 No.921740>>922002

>>921676

Every OS that exists right now is basically the same bullshit as UNIX, nigger.


 No.921797>>922178

>>921660

see OP pic


 No.921798

File (hide): e852b860600f76e⋯.png (438.77 KB, 750x1020, 25:34, 1518140158872.png) (h) (u)

>>921676

um you're pretty lost my 'Doze using buddy. most of the people here use Linux which is a UNIX.


 No.922002

>>921740

TempleOS

RiscOS

FreeDOS


 No.922111>>922134 >>922300

Everything in UNIX was fixed by Plan 9. Try out it's shell, rc, it truly is better than the inferior UNIX sh.


 No.922134>>922300

>>922111

Does rc solve the particular problem expressed in this thread's OP's text?


 No.922150

>>921122

How many are YOU responsible for?


 No.922176

>>so completely different group of people had to come with xorg, then another completely different group with wayland

BSD has won by attribution


 No.922178

>>921797

In this scenario, you're like a feminist screaming about how you should be allowed to shit in your husband's cereal and piss on his sheets and acts surprised when he reacts appropriately.


 No.922183

>>921630

>Let's not dislike bad things


 No.922185

>>921677

And GNU is Not Unix.


 No.922203>>922244 >>922300 >>922340

>>921373

>Not him

The question was for him.

Obviously every single other piece of software guards against loss of user work because the assumption is user work is valuable. Unix-like don't because the user work is assumed to be worthless and temporary or backed up on a fucking external tape.

It's a server OS the ~1.0% desktop usage speaks volumes.


 No.922244>>922262

>>922203

>the user work is assumed to be worthless

No its because normie OS tools are for retards the lowest common denominator. The trash can (so you can restore), the auto save (because they don't know how to save), the icloud (because they would rather apple store there shit than have to deal with backups themselves).


 No.922262

>>922244

Saving at all is for normies with shit-tier memories.


 No.922300

>>922111

>Everything in UNIX was fixed by Plan 9.

That would make Plan 9 a clone of Multics, but it's not. It doesn't use segmentation, it still has null-terminated strings, the commands are mostly ports of UNIX commands, it's still written in C, it still has broken fixed-length buffers, and dynamic linking was removed instead of fixed.

>>922134

No, it just made the documentation worse so you have to look at the source code to figure anything out. AT&T shills learned in the 80s that bad documentation and bad code can force programmers to learn C in order to understand and fix the OS, which is why so many C weenies appeared even though everyone knew C sucks.

>>922203

>Unix-like don't because the user work is assumed to be worthless and temporary or backed up on a fucking external tape.

"The user work is assumed to be worthless and temporary" is true, but backups are assumed to be worthless and temporary too.

>It's a server OS the ~1.0% desktop usage speaks volumes.

It sucks at servers even more, but companies can afford to hire a permanent weenie and buy more expensive hardware that can handle the wasted cycles and slow UNIX I/O.

Date: Fri 12 Apr 91 13:27:28-PDT
Subject: Re: Un*x Is The Pits ...


Stanford had a system called "labrea". It was (is?) a
vax 750 with 10 fuji eagles (4.5 Gbytes, which was a lot
when it was first around...)

Tape handling has always been a real weak point of unix.
Any real operating system has much better backup/restore
capabilities, and a lot of these are 10s of years old...

	From: BW
OK... /home/gn is back on-line and ready for use.

There were several read errors on the old disk
while the files were being transferred, and it's
impossible to tell exactly which files were
affected... If anyone finds any trashed or
incomplete files, let me know and I'll try to
retreive them from backup tapes.

Doesn't it give you that warm, confident feeling to know
that things aren't Quite Right, but that you'll have to wait
'til you need something to know Just What? Life on the
Edge.

Get with the program -- remember -- 90% is good enough. If
it's good enough for Ritchie, it's good enough for me!


 No.922314

>nooo don't improve unix!~ keep it crap forever

why though?


 No.922340>>922399

>>922203

Normalfags have no business using a shell just like they have no business playing around in a construction site. Powerful tools are dangerous.


 No.922361>>922367 >>922508

>>921575

jpegoptim ./-foo.jpg


 No.922365

>>921318

>not being spastic as fuck and accidentally pressing keys all over

I live to suffer.


 No.922367>>922372 >>922377 >>922508

>>922361

That works. But what if you're writing a script, and don't have fine control over the filenames? You can't blindly prepend ./, it doesn't work for absolute filenames. So now you have to check the first character of each filename, which is mildly annoying in bash and an absolute pain in bourne sh.

And that's without getting into tools that take arbitrary string arguments that don't represent filenames, and so don't support that workaround.

Unix is terrible around the edges. Central cases are nice and simple, edge cases are impossible to deal with consistently, if at all.


 No.922372>>922375 >>922508

>>922367

> That works. But what if you're writing a script, and don't have fine control over the filenames? You can't blindly prepend ./, it doesn't work for absolute filenames. So now you have to check the first character of each filename, which is mildly annoying in bash and an absolute pain in bourne sh.

You can do

jpegoptim `pwd`/-foo.jpg


 No.922375>>922508

>>922372

No, you can't. Let's say the filename is inside $fname, and we're in /home/user. The `pwd`/$fname for /tmp/foo.jpg becomes /home/user//tmp/foo.jpg, which is wrong.

Another problem is that you didn't quote it, so if there are spaces in the directory path it breaks.


 No.922377>>922384

>>922367

then use find


 No.922384

>>922377

I'm thinking of a case in which the filename was passed in by the user of the script and there's no other reason to mangle it.


 No.922399>>922418 >>922528

>>922340

>reeee hard hats are for normies

woah you are so cool


 No.922418>>922480

>>922399

Hard hats don't really get in the way at all. Real coal miners don't wear respirators because they are a PITA.


 No.922480>>922507 >>922509

>>922418

What's the analogy even mean? Making it so that mv, cp and rm don't assume your data is easily replaced is nowhere near adding some terrible user burden. Nor is fixing retarded bugs.


 No.922507

>>922480

when confronted with logical refutations these people just sperg out with false analogies instead of ever conceding defeat.


 No.922508

>>922375

>>922372

>>922367

>>922361

>>921575

THIS is why you need a "path" data type, separate from the "flag" data type.


 No.922509>>922510

>>922480

>RM should not actually delete files without asking

Why the fuck am I typing RM then


 No.922510

>>922509

inb4 *rm


 No.922528

>>922399

What the fuck do you even want? If you want your hand held through basic file operations then use a desktop's UI. If you want to do low level operations that are often unsafe use a shell.


 No.922539>>922793

>>921120 (OP)

Can't you just use quotes?

>rm this image.jpg

>no such file or directory

<rm "this image.jpg"


 No.922541

Unix filenames are pretty bad, in some cases they're even executable. The alternative is breaking compatibility and convenience though so just be less shit. A single find command can fix all your bullshit filenames on your whole system at once.


 No.922582>>922717 >>922794

>>921120 (OP)

>Currently in shell everything is a string

I know right OP?

If only they were using a binary format with well defined boundaries, like a null characters. But maybe systemd could be managing a shell too, that will fix the problem!


 No.922717>>922832

File (hide): 4ce91719b92ab92⋯.png (73.69 KB, 226x261, 226:261, extremely painful.png) (h) (u)

>>922582

>lennart poettering announces systemshell

>it has a feature that beeps when you try to do a tab completion but there's nothing to complete

>it's his excuse to have a shell hard depend on pulseaudio

>if you hold super+control while booting it puts you into a root busybox systemshell before the kernel even loads, he calls it "recovery mode"

>makes up his own regular expression system with ideas from C, every regular expression is a "\" followed by a letter, says the unix way "was fine in 1970 but it's 2018"

>for 8 months every regular expression is accidentally interpreted as a folder, Debian switches from bash to systemshell's old broken version anyway

>there's a transitional package supposed to allow POSIX and bash compatibility, but it's not fully conformant to either, closes bug reports telling people to fix their scripts


 No.922793

>>922539

quotes help but do not completely resolve the issue.

having separate data types for paths, flags and strings would fix it 100%.


 No.922794

>>922582

nul separated chars is actually a very very good way to work. I learned it from uriels non-harmful list (STOMP).


 No.922832>>928403

File (hide): ea3e05ad8f6db37⋯.gif (943.66 KB, 264x320, 33:40, 1417833922538.gif) (h) (u)

>>922717

STOP GIVING HIM IDEAS!


 No.922833

>using spaces in filenames

That Bitch deserved it.


 No.927001

File (hide): 30abe40244f99aa⋯.jpg (12.01 KB, 251x251, 1:1, 1YqdJUgT.jpg) (h) (u)

>>921122

t. Java nigger

Everything being a string is what makes Bash and similar shells so powerful and simple. Delimiting shit isn't that hard. Git gud pls


 No.927042>>927043


 No.927043>>927047

>>927042

Actually, between Intel, AMD, ARM, IBM, and Nvidia, Nvidia is the ONLY one without an R&D Center in Israel, that makes Nvidia the least Jewish of them all


 No.927046>>927279 >>927479


void
options() {
fprintf(stderr, "{\"flags\": {"
"\"--help:-h\": [\"void\", \"Shows help text\"],"
"\"--version:-v\": [\"void\", \"Shows version\"],"
"\"--depth\": [\"int\", 0, 100, 20, \"Recursion limit\"],"
"},\"args\": ["
"[\"file\", \"path\", \"File to read\"],"
"[\"report?\" \"path?\", \"Output file to write a report to\"],"
"]}");
}
//...
int
main(int argc, char **argv) {
//..
if (option == "--OPTIONS") {
options();
return 0;
}
//...
}

The shell will then automatically attempt to call --OPTIONS on programs and try to get valid JSON, and then validate the arguments. Of course this is still a hack to duct tape UNIX, but it's better than nothing. Now you can have the shell understand flags, paths and value types.


 No.927047

>>927043

True jews don't make it obvious they're jews.


 No.927227

>>921120 (OP)

>this shilling against the only OS model that isn't controlled by a single company

What a (((coincidence))).


 No.927244

>>921120 (OP)

you need to just get used to the unix way


 No.927279>>927316

>>927046

That's not safe. There are programs that don't take options at all, and would interpret a single --OPTIONS in their argv as an output file and happily start doing things they shouldn't be doing. It needs to be possible to determine without running the program.


 No.927316>>927479

>>927279

presumably the shell wouldn't pass --OPTIONS to the program


 No.927479

>>927316

That's what >>927046 said:

>call --OPTIONS on programs

This is fundamentally broken.


 No.927481

How about OP use his point-and-click GUI instead?


 No.928403

>>922832

>implying that faggot reads obscure mongolian nail art forums




[Return][Go to top][Catalog][Screencap][Nerve Center][Cancer][Update] ( Scroll to new posts) ( Auto) 5
105 replies | 7 images | Page ?
[Post a Reply]
[ / / / / / / / / / / / / / ] [ dir / animu / hispint / hwndu / lgbt / litpat / vg / vichan / vv ][ watchlist ]