Menu

Main Menu
Talk Get Daily Search

Member's Online

    User Name
    Password

    bashrc overwritten

    Reply
    wolke | # 1 | 2012-01-22, 23:33 | Report

    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.

    Edit | Forward | Quote | Quick Reply | Thanks

    Last edited by wolke; 2012-01-23 at 17:22.

     
    wolke | # 2 | 2012-01-22, 23:50 | Report

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

    Edit | Forward | Quote | Quick Reply | Thanks

     
    wolke | # 3 | 2012-01-22, 23:53 | Report

    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..

    Edit | Forward | Quote | Quick Reply | Thanks
    The Following User Says Thank You to wolke For This Useful Post:
    YavkatA

     
    zero.vishnu | # 4 | 2012-01-23, 07:57 | Report

    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.

    Edit | Forward | Quote | Quick Reply | Thanks

     
    wolke | # 5 | 2012-01-23, 17:19 | Report

    Originally Posted by zero.vishnu View Post
    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.

    Edit | Forward | Quote | Quick Reply | Thanks
    Attached Files
    File Type: txt bashrc.txt (2.1 KB, 138 views)

     
    rcolistete | # 6 | 2012-01-23, 20:59 | Report

    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

    Edit | Forward | Quote | Quick Reply | Thanks

     
    wolke | # 7 | 2012-01-23, 21:24 | Report

    Originally Posted by rcolistete View Post
    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.

    Edit | Forward | Quote | Quick Reply | Thanks

     
    rcolistete | # 8 | 2012-01-25, 14:57 | Report

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

    Edit | Forward | Quote | Quick Reply | Thanks
    The Following User Says Thank You to rcolistete For This Useful Post:
    wolke

     
    wolke | # 9 | 2012-01-25, 18:33 | Report

    Originally Posted by rcolistete View Post
    Yeah, I am surprised to confirm that '/root/.bashrc' has the PS1 overwritten !
    thx, glad this is not me-only. weird bug..

    Edit | Forward | Quote | Quick Reply | Thanks
    The Following User Says Thank You to wolke For This Useful Post:
    rcolistete

     
vBulletin® Version 3.8.8
Normal Logout