linutil icon indicating copy to clipboard operation
linutil copied to clipboard

Fix AutoLogin `printf` and `>` issues

Open adamperkowski opened this issue 1 year ago • 21 comments

Type of Change

  • [x] Bug fix
  • [x] Refactoring
  • [x] Hotfix

Description

A LOT of bugs here. Someone (@guruswarupa) didn't test this.

Issues / other PRs related

  • Resolves #654

Checklist

  • [x] My code adheres to the coding and style guidelines of the project.
  • [x] I have performed a self-review of my own code.
  • [x] My changes generate no errors/warnings/merge conflicts.

adamperkowski avatar Sep 23 '24 22:09 adamperkowski

@adamperkowski you'll have to go through and find the correct paths for each one, some of these are wrong

ghost avatar Sep 23 '24 22:09 ghost

@nnyyxxxx Who did this? I'd like to have a friendly talk with them...

adamperkowski avatar Sep 23 '24 22:09 adamperkowski

@nnyyxxxx Who did this? I'd like to have a friendly talk with them...

guru

ghost avatar Sep 23 '24 22:09 ghost

@guruswarupa ...

adamperkowski avatar Sep 23 '24 22:09 adamperkowski

https://wiki.archlinux.org/title/LightDM#Enabling_autologin

adamperkowski avatar Sep 23 '24 22:09 adamperkowski

I was wrong

The bsd man pages are so much better than the ones for gnutils

cartercanedy avatar Sep 23 '24 23:09 cartercanedy

I was wrong

The bsd man pages are so much better than the ones for gnutils

wrong

ghost avatar Sep 23 '24 23:09 ghost

thats only for bsd

ghost avatar Sep 23 '24 23:09 ghost

thats only for bsd

?

Which form are you talking about

cartercanedy avatar Sep 23 '24 23:09 cartercanedy

thats only for bsd

?

Which form are you talking about

the empty arg u mentioned in your edited message, only works for linux, bsd on the otherhand it would not work on

ghost avatar Sep 23 '24 23:09 ghost

thats only for bsd

?

Which form are you talking about

the empty arg u mentioned in your edited message, only works for linux, bsd on the otherhand it would not work on

sed -i'.old' 's/foo/bar/' test.txt produces a file named foo.txt.old

sed -i'' 's/foo/bar/' test.txt does not

cartercanedy avatar Sep 23 '24 23:09 cartercanedy

sed -i'.old' 's/foo/bar/' test.txt

that will work on bsd, but if u take the argument away it wont

ghost avatar Sep 24 '24 00:09 ghost

if there is no argument on linux it will work though, so you were only half right.

ghost avatar Sep 24 '24 00:09 ghost

sed -i'.old' 's/foo/bar/' test.txt

that will work on bsd, but if u take the argument away it wont

Correct, that's why I suggested the change

cartercanedy avatar Sep 24 '24 00:09 cartercanedy

I wasn't saying that I was wrong to suggest the change, just that the empty arg needed to be concatenated to the flag @nnyyxxxx

cartercanedy avatar Sep 24 '24 00:09 cartercanedy

I wasn't saying that I was wrong to suggest the change, just that the empty arg needed to be concatenated to the flag @nnyyxxxx

i understand i was only saying that you were partially wrong

ghost avatar Sep 24 '24 00:09 ghost

Ok, glad we agree... Right?

cartercanedy avatar Sep 24 '24 00:09 cartercanedy

Co-authors for you :)

adamperkowski avatar Sep 24 '24 00:09 adamperkowski

@guruswarupa ...

It seemed to work when those lines which you changed were echo. Later while changing it to printf, it broke. I did test on my system before adding it.

guruswarupa avatar Sep 24 '24 12:09 guruswarupa

It seemed to work when those lines which you changed were echo. Later while changing it to printf, it broke. I did test on my system before adding it.

On its face that's incorrect. The single string argument being passed to sudo will fail because it will assume that it's looking for an executable named "echo '...' > ...", which fails regardless of whether you substitute echo for printf. You'd either have to run sudo bash -c "..." or do what @adamperkowski did and utilize sudo tee to get the permissions right

cartercanedy avatar Sep 24 '24 16:09 cartercanedy

It seemed to work when those lines which you changed were echo. Later while changing it to printf, it broke. I did test on my system before adding it.

On its face that's incorrect. The single string argument being passed to sudo will fail because it will assume that it's looking for an executable named "echo '...' > ...", which fails regardless of whether you substitute echo for printf. You'd either have to run sudo bash -c "..." or do what @adamperkowski did and utilize sudo tee to get the permissions right

i'd recommend against using sub shells

ghost avatar Sep 24 '24 22:09 ghost