Defined DIFFPROG not valid for sudo

If i use pacdiff in console to handle *.pacnew files i get this horrible vi even if i defined installed meld:

[john1@manjaro ~]$ sudo echo $DIFFPROG
[sudo] Passwort für john1: 
meld

No, i never touch this one:

vi or vim ?

Forgot this systeminfo:

Manjaro-Loghelper

pacdiff is not to be used with sudo - there is the -s option for this. So what happens if you try

pacdiff -s

and

DIFFPROG=meld pacdiff -s

Yes.

But still I wonder…

How/Where did you define DIFFPROG, @JohnML ?

Continuing that thought, the right place would be ~/.profile and then you source the profile in ~/.bash_profile for example. In any case some profile file in your home.

the only i can remember is ~/.bashrc

export DIFFPROG=meld

That is ok too.

But that is no issue. if i do in terminal:

[john1@manjaro ~]$ su
Passwort: 
[manjaro john1]# echo $DIFFPROG
meld

And that is ok because meld is used.
A newbe will not even know how to even close vi … two times :q very intuitiv

What happens without su ? … I just added it to my ~/.bashrc; am going to test it if I have any new pacnew files.

I would add

DIFFPROG=/usr/bin/meld

to /etc/environment

and delete

export DIFFPROG=meld

from ~/.bashrc.

Afterwards, reboot!

1 Like

Then thats probably why.

~/.bashrc is only affecting your users bash prompt.

(and assuming you use bash at all)

Thats where I would put it too. No reason for this not to be global.

PS

Maybe you want to add some others there too. Like SUDO_EDITOR=/usr/bin/micro so you can use
sudoedit or sudo -e when you want to admin a file like a reasonable person. :slight_smile:

PPS

I thought there was an environment variable intro somewhere. Had to dig deep.

2 Likes

deleted

pacdiff will not ask you for password, if i remember it orrect.

But test it your own:

sudo cp /etc/locale.gen /etc/locale.gen.pacnew

then uncomment one line it , remove the # at beginning of valid line

nano  /etc/locale.gen.pacnew

save you changes with CTRL+o

Now you can play around with various options of pacdiff

pacdiff doesn’t ask for a password, by default, no. Because it tuns as the user executing it and tries to perform the relevant operations as that user. However, it does have an option use sudo/sudoedit:

$ man pacdiff
[...]
-s, --sudo
Use sudo and sudoedit to merge/remove files.
[...]

…for what it’s worth.

Thanks, that works and i don’t get shocked with vim or vi :slight_smile:

3 Likes

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.