Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Sapozhnik
Jan 2, 2005

Nap Ghost
reminds me of that one (unconfirmed) thing that GCC does where it detects somebody trying to use the XOR swap trick and just replaces it with a SWAP instruction.

I guess they probably detect a "tmp = a; a = b; b = tmp" type sequence and replace it with a SWAP already so I could believe them adding a similar pattern-match for XOR swapping too.

Adbot
ADBOT LOVES YOU

BobHoward
Feb 13, 2012

The only thing white people deserve is a bullet to their empty skull

Kiwi Ghost Chips posted:

i like systemd because anything that makes me less likely to look at bash scripts is good

as a programming language bash suffers from syntax / usability issues almost as bad as applescript

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
It's more to prevent against input like DAEMON="-n" breaking the script.

MrMoo
Sep 14, 2000

Soricidus posted:

it's a cargo-cult practice you'll see a lot in bad scripts. i guess some shell once had a bug where empty variables caused a syntax error even if you quoted them or something? in any case it's unnecessary in that instance and whoever wrote that did not understand why they were doing it any more than you did.

If the variable in question doesn't exist you will end up with a parsing error, adding quotes fixes it in modern bash but not older ones I think.

code:
$ if [ $MOO = "moo" ]; then echo moo; fi
-bash: [: =: unary operator expected

pram
Jun 10, 2001
bash is loving terrible and i hate people who use it and then dump their unmaintainable horseshit all over u like a giant ethereal anus

pram
Jun 10, 2001
gently caress perl too

pseudorandom name
May 6, 2007

MrMoo posted:

If the variable in question doesn't exist you will end up with a parsing error, adding quotes fixes it in modern bash but not older ones I think.

so how's life on the island, has john frum brought you anything nice lately?

pram
Jun 10, 2001
backticks or subshells huh, which one fuckers `ur -gay` $(ur -gay)

Captain Foo
May 11, 2004

we vibin'
we slidin'
we breathin'
we dyin'

pram posted:

giant ethereal anus

mods

Gazpacho
Jun 18, 2004

by Fluffdaddy
Slippery Tilde

Suspicious Dish posted:

It's more to prevent against input like DAEMON="-n" breaking the script.
it makes vague sense now, thanks

Rahu
Feb 14, 2009


let me just check my figures real quick here
Grimey Drawer

pram posted:

gently caress perl too

no, perl is nice + cool if you don't use it like an idiot

pram
Jun 10, 2001
lmao no

pram
Jun 10, 2001
although i will give perl one thing. its been dead for so long you can be sure your code will work even on ancient hpux and aix poo poo

Soricidus
Oct 21, 2010
freedom-hating statist shill

Suspicious Dish posted:

It's more to prevent against input like DAEMON="-n" breaking the script.

oh yes, i knew there was a better reason (and the fact that that gotcha had escaped my memory is a perfect illustration of why i've been trying to persuade people that, no, they really should be using at least perl or python or something, for the love of god please stop writing important things in ksh)

pram
Jun 10, 2001
well unless you used a module, good luck getting cpan to work

Kiwi Ghost Chips
Feb 19, 2011

Start using the best desktop environment now!
Choose KDE!

pram posted:

bash is loving terrible and i hate people who use it and then dump their unmaintainable horseshit all over u like a giant ethereal anus

pram posted:

gently caress perl too

Gazpacho
Jun 18, 2004

by Fluffdaddy
Slippery Tilde

Mr Dog posted:

reminds me of that one (unconfirmed) thing that GCC does where it detects somebody trying to use the XOR swap trick and just replaces it with a SWAP instruction.

I guess they probably detect a "tmp = a; a = b; b = tmp" type sequence and replace it with a SWAP already so I could believe them adding a similar pattern-match for XOR swapping too.
Gcc has a pretty smart bitwise expression simplifier that can probably eliminate all the XOR operations, from there you just need a rule in the machine description for x, y := y, x but I couldn't find the directory that contains the MDs. So it's not a special end to end rule for XOR swaps, just two parts of the compiler doing what they do

Notorious b.s.d.
Jan 25, 2003

by Reene

pram posted:

bash is loving terrible and i hate people who use it and then dump their unmaintainable horseshit all over u like a giant ethereal anus

Notorious b.s.d.
Jan 25, 2003

by Reene

pram posted:

gently caress perl too

at least perl has a debugger

pram posted:

although i will give perl one thing. its been dead for so long you can be sure your code will work even on ancient hpux and aix poo poo

i have ported a perl codebase from 5.10 on linux to 5.6 on hpux. i will never be the same man.

if you look into the abyss, the abyss looks back

BobHoward
Feb 13, 2012

The only thing white people deserve is a bullet to their empty skull
notorious bsd was correct

on the one hand perl is cool and kinda enjoyable and does everything youd like a shell scripting language to do but is also a real language (real data structures allowed!)

on the other it's a nightmarish web of weird special context dependent behaviors intended to help but sometimes they hlep you instead, a thousand different ways to do the same thing for no real good reason, cryptic syntax only larry wall could love, and constantly nagging annoyances due to the way that complex data structures were hacked into the language

Gazpacho
Jun 18, 2004

by Fluffdaddy
Slippery Tilde
I don't think that systemd's rejection of scripts has anything to do with readability, it's more that scripts create subprocesses for literally everything and then don't tell the service manager which ones it needs to monitor, maybe this could have been addressed in a politically correct way by defining a protocol for startup scripts to write info back to init on stdout but none of the beards has bothered to do that in 20 years so

Kiwi Ghost Chips
Feb 19, 2011

Start using the best desktop environment now!
Choose KDE!

Gazpacho posted:

it's more that scripts create subprocesses for literally everything

i don't understand why bash still does this

Notorious b.s.d.
Jan 25, 2003

by Reene

Gazpacho posted:

I don't think that systemd's rejection of scripts has anything to do with readability, it's more that scripts create subprocesses for literally everything and then don't tell the service manager which ones it needs to monitor, maybe this could have been addressed in a politically correct way by defining a protocol for startup scripts to write info back to init on stdout but none of the beards has bothered to do that in 20 years so

smf did this, and it is/was really awesome. smf was just a process monitor. it didn't even try to replace pid 1. smf starts daemons and monitors them, that's it.

systemd does about sixty things and hijacks stuff that previously worked just fine. it is complicated and a little scary and not an opt-in item. it is forced on you.

people are mad about systemd because they didn't get to choose systemd. there was no positive case made. folks didn't migrate to it by choice. it just showed up one day, uninvited

Notorious b.s.d.
Jan 25, 2003

by Reene

Kiwi Ghost Chips posted:

i don't understand why bash still does this

bash does it less than any previous shell. a lot of stuff that used to live in /bin is implemented as bash builtins

it's just that shell scripting is an abomination. no number of builtins will ever make it a sane way to write software

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe

Gazpacho posted:

I don't think that systemd's rejection of scripts has anything to do with readability, it's more that scripts create subprocesses for literally everything and then don't tell the service manager which ones it needs to monitor

It's both. There's a bunch of reasons that systemd rejected init scripts.

SYSV Fanfic
Sep 9, 2003

by Pragmatica
I remember when I was in college and I thought c/c++ development was the most noble calling.

What I'm saying is I was p. loving stupid when I was young.

pram
Jun 10, 2001
supervisord still exists guys

Gazpacho
Jun 18, 2004

by Fluffdaddy
Slippery Tilde

Kiwi Ghost Chips posted:

i don't understand why bash still does this
Because it is a command shell

Kiwi Ghost Chips
Feb 19, 2011

Start using the best desktop environment now!
Choose KDE!

Gazpacho posted:

Because it is a command shell

i mean poo poo like command substitution causing bash to fork even for a builtin

pseudorandom name
May 6, 2007

I'm sure you can find a useful explanation for the why in the commit log

Captain Foo
May 11, 2004

we vibin'
we slidin'
we breathin'
we dyin'

pseudorandom name posted:

I'm sure you can find a useful explanation for the why in the commit log

hahaha

Gazpacho
Jun 18, 2004

by Fluffdaddy
Slippery Tilde

Notorious b.s.d. posted:

smf did this, and it is/was really awesome. smf was just a process monitor. it didn't even try to replace pid 1. smf starts daemons and monitors them, that's it.

systemd does about sixty things and hijacks stuff that previously worked just fine. it is complicated and a little scary and not an opt-in item. it is forced on you.

people are mad about systemd because they didn't get to choose systemd. there was no positive case made. folks didn't migrate to it by choice. it just showed up one day, uninvited
If you're going to talk complexity you better be comparing systemd to the rc system as a whole and not just to init, and as for choice well I'd consider that a consequence of not fixing what was broken in the rc system for so long

Gazpacho fucked around with this message at 22:37 on Nov 2, 2014

Gazpacho
Jun 18, 2004

by Fluffdaddy
Slippery Tilde
rc more like wreck haha lol

Notorious b.s.d.
Jan 25, 2003

by Reene

Gazpacho posted:

If you're going to talk complexity you better be comparing systemd to the rc system as a whole and not just to init, and as for choice well I'd consider that a consequence of not fixing what was broken in the rc system for so long

yes that is the point

smf fixed the rc system without the need to break logging, replace init, set up a system dbus etc etc

pram
Jun 10, 2001
its almost like commercial unixes were designed by competent people and not committees of mouthbreathing spergs

Qtotonibudinibudet
Nov 7, 2011



Omich poluyobok, skazhi ty narkoman? ya prosto tozhe gde to tam zhivu, mogli by vmeste uyobyvat' narkotiki

pram posted:

its almost like commercial unixes were designed by competent people and not committees of mouthbreathing spergs

someone has never used AIX or HP-UX

pram
Jun 10, 2001
ive used both and AIX isnt bad i mean smit is good and odm is fine

hpux well, itanium lol

Broken Machine
Oct 22, 2010

IPvSH6T posted:

someone has never used AIX or HP-UX

Whatever else you can complain with about AIX, properly configured it is one of the most stable and secure choices for a UNIX system.

Notorious b.s.d.
Jan 25, 2003

by Reene
lol at describing aix or hp-ux in the present tense

Adbot
ADBOT LOVES YOU

pram
Jun 10, 2001
uhh aix is still in a ton of places because of DB2

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply