[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    Re: ash fails to read $HOME/.profile
From:       "KP.Kirchdoerfer" <kapeka () bering-uclibc ! de>
Date:       2017-06-26 19:47:35
Message-ID: 1532405.bibpaoYQps () stalker
[Download RAW message or body]

Am Montag, 26. Juni 2017, 21:07:21 schrieb Tito:
> On 06/26/2017 06:37 PM, KP.Kirchdoerfer wrote:
> > Am Sonntag, 25. Juni 2017, 22:01:34 schrieb Tito:
> >> On 06/25/2017 04:20 PM, KP.Kirchdoerfer wrote:
> >>> HI;
> >>> 
> >>> Am Samstag, 24. Juni 2017, 22:03:36 schrieb Tito:
> >>>> On 06/24/2017 06:21 PM, KP.Kirchdoerfer wrote:
> >>>>> Hi;
> >>>>> 
> >>>>> I'm using busybox 1.25.1 and when loggingin as root it successfully
> >>>>> reads
> >>>>> /root/.profile.
> >>>>> 
> >>>>> Running latest busybox snapshot this fails due to this commit
> >>>>> 
> >>>>> https://git.busybox.net/busybox/commit/shell?id=2eb0a7e1b9a579ba34e478
> >>>>> 0c
> >>>>> 9e
> >>>>> d8e74f38bc6b85
> >>>>> 
> >>>>> What can be wrong on my side and needs to be changed for a newer
> >>>>> busybox
> >>>>> version?
> >>>>> 
> >>>>> TIA kp
> >>>> 
> >>>> Hi,
> >>>> is the HOME var set correctly in the environment after login in as
> >>>> set in the users' /etc/passwd entry?
> >>> 
> >>> The file question is /root/.profile:;
> >>> 
> >>>> Like e.g:
> >>>> 
> >>>> HOME='/home/tito'
> >>> 
> >>> env shows:
> >>> HOME=/root
> >>> 
> >>>> Is the /etc/passwd file entry correct?
> >>>> 
> >>>> tito:x:1000:1000:tito,,,:/home/tito:/bin/bash
> >>> 
> >>> Even though mine looked like this one
> >>> root:x:0:0:root:/root:/bin/sh
> >>> 
> >>> I've changed to
> >>> root:x:0:0:root,,,:/root:/bin/sh
> >>> 
> >>> but makes no difference.
> >>> 
> >>> I've thought also adding ENV to the code is an addition and is an
> >>> "either
> >>> (~/.profile), or(ENV)"...?
> >>> 
> >>> regards kp
> >>> 
> >>>> Ciao,
> >>>> Tito
> >> 
> >> Hi,
> >> 
> >> could you try to add this debug code and then try to login.
> >> 
> >> diff -uN shell/ash.c shell/ash.c.tito
> >> --- shell/ash.c 2017-06-25 21:52:49.156426570 +0200
> >> +++ shell/ash.c.tito    2017-06-25 21:43:51.000000000 +0200
> >> @@ -13515,7 +13515,9 @@
> >> 
> >>   static void
> >>   read_profile(const char *name)
> >>   {
> >> 
> >> +       ash_msg("%s", name); /* Tito */
> >> 
> >>          name = expandstr(name);
> >> 
> >> +       ash_msg("%s", name); /* Tito */
> >> 
> >>          if (setinputfile(name, INPUT_PUSH_FILE | INPUT_NOFILE_OK) < 0)
> >>          
> >>                  return;
> >>          
> >>          cmdloop(0);
> >> 
> >> @@ -13623,7 +13625,7 @@
> >> 
> >>                  isloginsh = 1;
> >>          
> >>          if (isloginsh) {
> >>          
> >>                  const char *hp;
> >> 
> >> -
> >> +ash_msg("Loginsh"); /* tito*/
> >> 
> >>                  state = 1;
> >>                  read_profile("/etc/profile");
> >>    
> >>    state1:
> >> ----------------------------------------------------------------------
> >> 
> >> I did it, copied the busybox binary to /bin/ash
> >> changed the login shell for root in /etc/passwd to /bin/ash
> >> and after login got:
> >> 
> >> -ash: Loginsh
> >> -ash: /etc/profile
> >> -ash: /etc/profile
> >> -ash: $HOME/.profile
> >> -ash: /root/.profile
> >> 
> >> So on debian 8 with latest busybox from git it seems to work correctly.
> >> I'm curious to see what it does print out for you.
> > 
> > Thx for your help!
> > 
> > I did;
> > first with shell sh in /etc/passwd linked to ash, second with /bin/ash in
> > /etc/passwd
> > 
> >  -sh: Loginsh
> >  -sh: /etc/profile
> >  -sh: /etc/profile
> > 
> > Type in help if you are really lost
> > 
> >  -sh: $HOME/.profile
> >  -sh:$HOME/.profile
> >  
> >  -ash: Loginsh
> >  -ash: /etc/profile
> >  -ash: /etc/profile
> > 
> > Type in help if you are really lost
> > 
> >  -ash: $HOME/.profile
> >  -ash:$HOME/.profile
> > 
> > The line "Type in help if you are really lost" is from /etc/profile see
> > below
> > 
> > Running "env" just after login show
> > HOME=/root
> > 
> > /sbin/init is a link to busybox.
> > 
> > kp
> > 
> > PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
> > LD_LIBRARY_PATH="/usr/local/lib:/usr/lib:/lib"
> > HOSTNAME="$(hostname)"
> > 
> > #Set the prompt
> > PS1="$HOSTNAME$ "
> > 
> > EDITOR=e3ne
> > 
> > umask 022
> > alias dir="ls"
> > alias vdir="ls -l"
> > alias ll="ls -l"
> > alias d="ls"
> > alias v="ls -l"
> > alias da="ls -a"
> > alias va="ls -la"
> > 
> > alias m="more"
> > alias +="more"
> > 
> > alias lo="exit"
> > 
> > alias w="uptime; who"
> > 
> > export PATH LD_LIBRARY_PATH HOSTNAME PS1 EDITOR
> > 
> > echo
> > echo "Type in help if you are really lost"
> > # echo
> 
> Hi,
> so the $HOME string expansion is failing in your case
> but not in mine.
> Looking at code a question arises:
> 
> #if ENABLE_ASH_EXPAND_PRMT
> /* expandstr() needs parsing machinery, so it is far away ahead... */
> static const char *expandstr(const char *ps);
> #else
> #define expandstr(s) s
> #endif
> 
> Did you enable  ENABLE_ASH_EXPAND_PRMT in your config ?

No; 
Enabled and tested successfully.

Issue solved.

Thx a lot for help and patience!

kp
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic