[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: New utility suggestion: chdir(1)
From: |
Pádraig Brady |
Subject: |
Re: New utility suggestion: chdir(1) |
Date: |
Sun, 27 Aug 2017 19:33:17 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 |
On 27/08/17 00:23, Colin Watson wrote:
> On Sat, Aug 26, 2017 at 04:00:11PM -0700, Pádraig Brady wrote:
>> If we were to provide this I think chdir is a fine name.
>> It's a pity we have to have this heavy weight chaining of execs like this
>> to set each process attribute. This is more general though, than adding
>> --chdir to other "context" type programs like chroot etc.
>> Note GNU chroot has a --skip-chdir which nearly does what you want.
>> I.E. you could os.chdir("/chroot/build") before calling "chroot --skip-dir
>> ...",
>> however that's currently restricted for greater protection to when
>> you're not actually changing the root directory. I suppose we could relax
>> the check to verify that getcwd() was _below_ the specified chroot path.
>> Of course none of this helps with jexec, lxc etc.
>
> Indeed; I really want something composable rather than playing
> whack-a-mole with every possible wrapper command.
>
>> Another option to consider is to add --chdir to env(1) since they
>> would often be used together and could be done more efficiently with a
>> single exec?
>
> That's a good idea, and I agree they're often used together. I'd
> already slipped and implemented chdir(1), but I think that suggestion
> may be better: it results in a much shorter patch, and it avoids the
> problem with some shells (e.g. zsh) implementing their own "chdir"
> built-ins with different semantics.
>
> I've attached both patches; my preference following Pádraig's suggestion
> is the second one ("env: add --chdir option"), but I'd be happy either
> way.
Cool, I'll include your `env` change in the upcoming release.
I think supporting -C aligns well with other utils,
and has little chance of conflicting with existing implementations,
so I'll tweak your patch to allow that.
thanks!
Pádraig
- New utility suggestion: chdir(1), Colin Watson, 2017/08/26
- Re: New utility suggestion: chdir(1), Colin Watson, 2017/08/26
- Re: New utility suggestion: chdir(1), Pádraig Brady, 2017/08/26
- Re: New utility suggestion: chdir(1), Colin Watson, 2017/08/27
- Re: New utility suggestion: chdir(1),
Pádraig Brady <=
- Re: New utility suggestion: chdir(1), Bernhard Voelker, 2017/08/28
- Re: New utility suggestion: chdir(1), Pádraig Brady, 2017/08/28
- Re: New utility suggestion: chdir(1), Pádraig Brady, 2017/08/28
- Re: New utility suggestion: chdir(1), Jim Meyering, 2017/08/29
- Re: New utility suggestion: chdir(1), Pádraig Brady, 2017/08/29
- Re: New utility suggestion: chdir(1), Colin Watson, 2017/08/29
Re: New utility suggestion: chdir(1), Kaz Kylheku (Coreutils), 2017/08/26
Re: New utility suggestion: chdir(1), Kaz Kylheku (Coreutils), 2017/08/27