Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression with source command #15795

Closed
julianoes opened this issue Sep 23, 2020 · 5 comments
Closed

Regression with source command #15795

julianoes opened this issue Sep 23, 2020 · 5 comments
Assignees
Labels
bug Sim: SITL software in the loop simulation

Comments

@julianoes
Copy link
Contributor

The recent change (6e1078c) using source instead of . doesn't work on my Arch Linux:

px4 starting.

INFO  [px4] Calling startup script: /bin/sh etc/init.d-posix/rcS 0
/home/julianoes/src/Firmware/build/px4_sitl_default/bin/px4-alias.sh: line 42: `source': is a special builtin
ERROR [px4] Startup script returned with return value: 512

FYI @dagar @davids5

@julianoes julianoes added bug Sim: SITL software in the loop simulation labels Sep 23, 2020
@MaEtUgR
Copy link
Member

MaEtUgR commented Sep 23, 2020

I have the same with GNU bash, version 5.0.17. I expected other platforms than Cygwin to have these problems since Cygwin doesn't reinvent bash but just keeps it up to date. The last discussion about this topic was: #15139 (comment)

It breaks with 185ffe9 and gives me

/home/maetugr/Firmware/build/px4_sitl_default/tmp/rootfs/etc/init.d/rc.vehicle_setup: line 81: /etc/init.d/rc.interface: No such file or directory
ERROR [px4] Startup script returned with return value: 256

With 6e1078c the error changes to

/home/maetugr/Firmware/build/px4_sitl_default/bin/px4-alias.sh: line 42: `source': is a special builtin
ERROR [px4] Startup script returned with return value: 512

What about we try what @bkueng suggests? #15139 (comment)

The main difficulty is that both source and . require an absolute path.
If we need to avoid overriding altogether, we can add a prefix variable, $PWD on POSIX, and / on NuttX: . ${R}etc/init.d/rc.fw_defaults

@dagar
Copy link
Member

dagar commented Sep 23, 2020

I'll dig into this later if no one has an immediate solution on hand.

If possible we should also probably favor . over source to maximize compatibility with POSIX sh.

@dagar dagar self-assigned this Sep 23, 2020
@coderkalyan
Copy link
Contributor

Able to replicate this on Arch as well. Seems to be bash-specific, since Arch and Cygwin symlink bash to /bin/sh while Ubuntu uses dash (which is technically more POSIX compliant). Tested by relinking /bin/sh to dash and it works fine.

@MaEtUgR
Copy link
Member

MaEtUgR commented Sep 26, 2020

I did some more tests and replacing source with e.g. so in https://github.com/PX4/Firmware/blob/a24488328f175e4657ad449996c42260e4da9c92/platforms/posix/src/px4/common/px4-alias.sh_in#L31 gets rid of the error 512 'source': is a special builtin but then it fails because of rc.vehicle_setup invoking NuttX path scripts -> No such file or directory e.g. with multicopter here: https://github.com/PX4/Firmware/blob/a24488328f175e4657ad449996c42260e4da9c92/ROMFS/px4fmu_common/init.d/rc.vehicle_setup#L80-L84

After reverting those to sh instead of source it works again. So I guess a variable for the path of invoked scripts which is empty on NuttX would make sense right?

@MaEtUgR
Copy link
Member

MaEtUgR commented Oct 20, 2020

This was resolved by #15970

@MaEtUgR MaEtUgR closed this as completed Oct 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Sim: SITL software in the loop simulation
Projects
None yet
Development

No branches or pull requests

4 participants