つぶやいて...

su user vs su - user

When I am debugging c programming in server, I found that I can’t jump into the functions like strlen or malloc. It is so weird because I remember I can jump into those functions in my laptop.

So I thought it maybe is lack some configures or software. But I found any configures is same after compared two environment. Then I saw this Debuginfod. It say that gdb will automatically download debug files from servers whose url is set by environment variable DEBUGINFOD_URLS.

I executed echo $DEBUGINFOD_URLS, it printed nothing, but I got the url when I login to another user. I use to switch another user to programming with command su user. Finally I found that command su user and su - user is big difference.

[teliang@server ~]$ echo $DEBUGINFOD_URLS
https://debuginfod.archlinux.org
[teliang@server ~]$ sudo su teliang2
[teliang2@server teliang]$ echo $DEBUGINFOD_URLS

[teliang2@server teliang]$ 
exit
[teliang@server ~]$ sudo su - teliang2
[teliang2@server ~]$ echo $DEBUGINFOD_URLS
https://debuginfod.archlinux.org

I swear I never use su user anymore.