You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by "pussuw (via GitHub)" <gi...@apache.org> on 2024/08/01 12:05:38 UTC
[PR] binfmt_loadmodule.c: Look for executables from PWD, if not found from PATH [nuttx]
pussuw opened a new pull request, #12822:
URL: https://github.com/apache/nuttx/pull/12822
## Summary
This expands the search for executables to the current working directory, if the executable is not found from PATH.
Why do this?
Starting processes now works similarly when envpaths are not used, in which case the inode search procedure peeks into PWD via inode_search -> _inode_getcwd.
This is just a user experience enhancement.
## Impact
Tiny, only when CONFIG_LIBC_ENVPATH=y and executable is not in PATH
## Testing
Target with file applications and CONFIG_LIBC_ENVPATH=y
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] binfmt_loadmodule.c: Look for executables from PWD, if not found from PATH [nuttx]
Posted by "acassis (via GitHub)" <gi...@apache.org>.
acassis commented on PR #12822:
URL: https://github.com/apache/nuttx/pull/12822#issuecomment-2263142585
@pussuw so, with this modification, if hello is not in the PATH, but it is in the local directory, it be executed, even if we don't call ./hello explicitly? That is it?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] binfmt_loadmodule.c: Look for executables from PWD, if not found from PATH [nuttx]
Posted by "pussuw (via GitHub)" <gi...@apache.org>.
pussuw closed pull request #12822: binfmt_loadmodule.c: Look for executables from PWD, if not found from PATH
URL: https://github.com/apache/nuttx/pull/12822
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] binfmt_loadmodule.c: Look for executables from PWD, if not found from PATH [nuttx]
Posted by "pussuw (via GitHub)" <gi...@apache.org>.
pussuw commented on PR #12822:
URL: https://github.com/apache/nuttx/pull/12822#issuecomment-2264971058
Yes, this patch is 100% in violation with POSIX.
Also, running CONFIG_NSH_FILE_APPS=y when CONFIG_LIBC_ENVPATH=n is 100% in violation with POSIX, because running programs from CWD works without the ./ notation in this configuration.
Also, what I'm trying to do here is easily done by adding . to path, so in addition to being a standards violation, it is also completely redundant.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] binfmt_loadmodule.c: Look for executables from PWD, if not found from PATH [nuttx]
Posted by "pussuw (via GitHub)" <gi...@apache.org>.
pussuw commented on PR #12822:
URL: https://github.com/apache/nuttx/pull/12822#issuecomment-2263205327
> @pussuw so, with this modification, if hello is not in the PATH, but it is in the local directory, it be executed, even if we don't call ./hello explicitly? That is it?
Exactly yes. The reason I did the change is because it works differently depending on CONFIG_LIBC_ENVPATH=y/n.
With CONFIG_LIBC_ENVPATH=n the `inode_search `procedure looks for the file in CWD. With CONFIG_LIBC_ENVPATH=y only PATH is used. After this change both work like it did with CONFIG_LIBC_ENVPATH=n.
Did not look at standards if using both PATH and CWD to find executables is legal. If not, then CONFIG_LIBC_ENVPATH=n behavior is wrong and needs to change (when using fileapps). Maybe this should not be merged before a we've had a discussion about it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] binfmt_loadmodule.c: Look for executables from PWD, if not found from PATH [nuttx]
Posted by "acassis (via GitHub)" <gi...@apache.org>.
acassis commented on PR #12822:
URL: https://github.com/apache/nuttx/pull/12822#issuecomment-2263246266
> Btw, does ./hello work with nsh ? I don't think it parses . as the CWD, i.e. it does not work with relative paths, only paths in PATH and absolute paths from the fs root ?
Good point, currently ./hello is not supported. It is something we need to fix.
But I think running an executable from current directory by default should be avoided (for security reasons)
There are some references here:
https://askubuntu.com/questions/1260013/why-does-a-out-work-but-a-out-doesnt
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] binfmt_loadmodule.c: Look for executables from PWD, if not found from PATH [nuttx]
Posted by "pussuw (via GitHub)" <gi...@apache.org>.
pussuw commented on PR #12822:
URL: https://github.com/apache/nuttx/pull/12822#issuecomment-2263224045
Btw, does ./hello work with nsh ? I don't think it parses . as the CWD, i.e. it does not work with relative paths, only paths in PATH and absolute paths from the fs root ?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] binfmt_loadmodule.c: Look for executables from PWD, if not found from PATH [nuttx]
Posted by "pussuw (via GitHub)" <gi...@apache.org>.
pussuw commented on PR #12822:
URL: https://github.com/apache/nuttx/pull/12822#issuecomment-2263262414
> > Btw, does ./hello work with nsh ? I don't think it parses . as the CWD, i.e. it does not work with relative paths, only paths in PATH and absolute paths from the fs root ?
>
> Good point, currently ./hello is not supported. It is something we need to fix.
>
> But I think running an executable from current directory by default should be avoided (for security reasons)
>
> There are some references here: https://askubuntu.com/questions/1260013/why-does-a-out-work-but-a-out-doesnt
Thanks for the reference. I'll take a look at POSIX tomorrow, it is what defines how the shell should work. Either way, something is not working like it should right now :)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org