maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Nokia N9 / N950 (https://talk.maemo.org/forumdisplay.php?f=51)
-   -   bashrc overwritten (https://talk.maemo.org/showthread.php?t=81794)

wolke 2012-01-22 23:33

bashrc overwritten
 
whoa: does anyone find that their .bashrc file gets overwritten?
something appears to touch just the line that sets PS1. this could be me somehow, but i really dont think so....

Code:

diff /root/.bashrc /root/.bashrc-from-before-reboot
h='\h'
u='\u'
w='\w'
c1='\[\033[01;32m\]'
c2='\[\033[01;34m\]'
cEnd='\[\033[00m\]'
-PS1="$c1$u$h$cEnd:$c2$w$cEnd\$ "
+PS1='\h-40-4_PR_005:$c2$w$cEnd\$ "

it appears to find a line that looks like
Code:

PS1=(BEFORE):(AFTER)
and replace it with
Code:

PS1='\h-VERSION:AFTER
.

which is really annoying, since it is malformed if you dont have a closing single quote {which i dont, as above}.

im going to add another line that sets it more obliquely until i figure out WHAT is setting it and kill it.

EDIT: a workaround is to do COLON=':', and then use $COLON instead of ':' in the line that sets the PS1.
this is not a solution, though, because the replace pattern is so general it could produce all sorts of, erm, interesting behaviour, like bricking my n9.

wolke 2012-01-22 23:50

Re: bashrc overwritten
 
im using bash, btw, not ash.
i have a .profile:
unset DISPLAY && exec bash

wolke 2012-01-22 23:53

Re: bashrc overwritten
 
after more extensive testing, it seems that ANY line that matches the perl regex:

Code:

(.*)PS1=(.*):(.*)
will be replaced with
Code:

$1PS1=$x:$2
where $x is something like
Code:

\h-40-4_PR_005
including comments...

#no PS1=.*:.* line, so n9 wont kill it
=>
#no PS1='\h-40-4_PR_005:.* line, so n9 wont kill it



this is SO stupid its incredible..

zero.vishnu 2012-01-23 07:57

Re: bashrc overwritten
 
Hi,

It is possible that there is a watchdog service running in the background that prevents bashrc from being modified.

But more importantly, why are you tinkering with bashrc? You could just write your own script, and set whatever paths you want there.

wolke 2012-01-23 17:19

Re: bashrc overwritten
 
1 Attachment(s)
Quote:

Originally Posted by zero.vishnu (Post 1154275)
Hi,

It is possible that there is a watchdog service running in the background that prevents bashrc from being modified.

But more importantly, why are you tinkering with bashrc? You could just write your own script, and set whatever paths you want there.

thanks for the reply!

this is my own .bashrc, in $HOME. i use it on every system that runs bash, {n900, laptop, n9, desktop, android ereader, etc}.


the bashrc works fine. i have an open kernel installed, and bash is running nicely, both when i ssh in and when i run meego-terminal. my aliases work, my gnu find/grep work {instead of busybox}.


....until i reboot.
when i reboot, the $HOME/.bashrc gets modified in a strange fashion.

it doesnt get replaced entirely, which i would understand and try to workaround.

only certain lines get changed, and in a very poorly programmed way.

the lines that get changed have to have the string "PS1=" and then the string ":" somewhere after it. lines that meet this arbitrary criteria are replaced as i describe above.

rcolistete 2012-01-23 20:59

Re: bashrc overwritten
 
I also use bash (but not as default shell) on Nokia N9, and the .bashrc is never rewritten. My PS1 line :


Code:

# Set colors for prompt
#
col_bold="\033[1m"
col_red="\033[1;31m"
col_green="\033[1;32m"
col_yellow="\033[1;33m"
col_blue="\033[1;34m"
col_purple="\033[1;35m"
col_cyan="\033[1;36m"
col_normal="\033[0;39m"

# Prompt Settings
# PS1
PS1="\[${col_cyan}\]\u@\h:\[${col_blue}\]\w\[${col_normal}\]\$ "
export PS1


wolke 2012-01-23 21:24

Re: bashrc overwritten
 
Quote:

Originally Posted by rcolistete (Post 1154621)
I also use bash (but not as default shell) on Nokia N9, and the .bashrc is never rewritten. My PS1 line :


Code:

# Set colors for prompt
#
col_bold="\033[1m"
col_red="\033[1;31m"
col_green="\033[1;32m"
col_yellow="\033[1;33m"
col_blue="\033[1;34m"
col_purple="\033[1;35m"
col_cyan="\033[1;36m"
col_normal="\033[0;39m"

# Prompt Settings
# PS1
PS1="\[${col_cyan}\]\u@\h:\[${col_blue}\]\w\[${col_normal}\]\$ "
export PS1


cool! now, do you put it in /home/.bashrc, or /root/.bashrc {root's home dir}

i believe only the one in /root/.bashrc is getting rewritten for me, contrary to what i implied earlier.

rcolistete 2012-01-25 14:57

Re: bashrc overwritten
 
Yeah, I am surprised to confirm that '/root/.bashrc' has the PS1 overwritten !

wolke 2012-01-25 18:33

Re: bashrc overwritten
 
Quote:

Originally Posted by rcolistete (Post 1155517)
Yeah, I am surprised to confirm that '/root/.bashrc' has the PS1 overwritten !

thx, glad this is not me-only. weird bug..


All times are GMT. The time now is 20:54.

vBulletin® Version 3.8.8