Skip to content

cd $oldpwd in enter-chroot is a host path, not a guest path #53

Description

@andychu

These lines don't seem to make sense:

		oldpwd="$(pwd)"
...

		$_sudo chroot . /usr/bin/env -i su -l "$user" \
		    sh -c ". /etc/profile; . /env.sh; cd '$oldpwd' 2>/dev/null; \"\$@\"" \
		    -- "${@:-sh}"

because

  • $oldpwd is a host path
  • after you chroot, you're in the guest
  • then you cd into a host path in the guest, which likely does NOT exist

It is harmless, but it looks like dead code to me. And the error message is supressed with 2>/dev/null.


I have a few more fixes in the fork https://github.com/oils-for-unix/alpine-chroot-install if interested

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions