[OpenWrt-Devel] [PATCH] base-files: add /etc/profile.d support

Matthias Schiffer mschiffer at universe-factory.net
Wed Jun 10 08:15:40 EDT 2015


On 06/10/2015 02:01 PM, Bastian Bittorf wrote:
> * thomas.langer at lantiq.com <thomas.langer at lantiq.com> [10.06.2015 13:59]:
>> I think this will not work, as /etc/profile (and these additional files) is expected to be executed in the current shell context.
>> Otherwise adding shell variables or extending $PATH will not work. So you cannot execute them in a subshell.
> 
> ok, then please:
> [ -e "$FILE" ] && sh -n "$FILE" && . "$FILE"
> 
>> Maybe it is possible to skip this for FAILSAFE mode? If there are errors, they can be corrected in this way.
> 
> this is a good point:
> 
> [ -z "$FAILSAFE" ] && {
>   ...yourlogic...
> }
> 
> bye, bastian

Why should errors in these files cause login issues? This is shell and
there's no -e, problematic lines will print an error and be skipped.

Hendrik's patch adds exactly the lines used by Debian. On Arch Linux, it
looks very similar.

The only way to break login using profile snippets is causing the shell
to exit explicitly (using `exit` or something like that), but there's no
sane way to protect against that...

Matthias

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/openwrt-devel/attachments/20150610/55e1d139/attachment.sig>
-------------- next part --------------
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


More information about the openwrt-devel mailing list