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

Building ksh on opensuse wipes out home directory #477

Closed
siteshwar opened this Issue Apr 17, 2018 · 3 comments

Comments

Projects
None yet
2 participants
@siteshwar
Collaborator

siteshwar commented Apr 17, 2018

There are some serious issues with how test cases were run in the last stable release. I installed rpm sources for ksh on opensuse with zypper source install ksh and did rpmbuild -ba ksh.spec. Test cases were run during the build and I saw errors like :

/tmp/ksh-build.hZy52m/tmp_1d.huj
test alias begins at 2018-04-17+19:44:20
/tmp/ksh-build.hZy52m/tmp_3a.92s
alias.sh[90]: /foo: cannot create [Permission denied]
chmod: cannot access '/foo': No such file or directory
	alias.sh[93]: hash -r -- foo failed, expected foo=/foo, got 
alias.sh[90]: /-foo: cannot create [Permission denied]
chmod: cannot access '/-foo': No such file or directory
	alias.sh[93]: hash -r -- -foo failed, expected -foo=/-foo, got 
alias.sh[90]: /--: cannot create [Permission denied]

At the end, my home directory was wiped out and filled with files like:

a  a-b  abc  abd  abe  aXb  b  bb  bcd  bdir  Beware  c  ca  cb  d  dd  de  man

These files are created by ksh test script. @bitstreamout Are you aware about this issue ? I am running a vanilla openSUSE Leap 42.3 system.

@krader1961 I have seen .sh_history file being modified when I run test cases on my fedora system. We should run the test cases in a sandboxed environment.

@krader1961

This comment has been minimized.

Collaborator

krader1961 commented Apr 17, 2018

I'm just about to open a PR that will fix this; or at least lay the groundwork for fixing this in a comprehensive manner. I've got a new test runner script that ensures every unit test is run in its own unique directory, with consistent env vars, and using a consistent preamble and postscript around each unit test. This is part of fixing #429 and #461.

@krader1961 krader1961 self-assigned this Apr 17, 2018

@krader1961 krader1961 added the cleanup label Apr 17, 2018

krader1961 added a commit to krader1961/ast that referenced this issue Apr 18, 2018

Unify the unit test framework
This modifies how ksh unit tests are run to have a consistent
environment (i.e., preamble) and post test behavior (i.e., postscript).
There was at least one unit test that did not correctly report the
number of errors via the exit status.

Each test is now run in a unique temporary directory. If the test
doesn't complete without error the temp dir is not removed. This makes
it easier when running the tests on a personal system (rather than, say,
a CI environment like Travis) to explore the state of the unit test.

The `HOME` env var is now set to the temp dir to help keep the test from
modifying the user's environment (e.g., their ~/.sh_history file).

Resolves att#429
Resolves att#477
@siteshwar

This comment has been minimized.

Collaborator

siteshwar commented Apr 18, 2018

It would be a good idea to put a warning before running test cases in the legacy test script. Wiping out your home directory is the last thing you would want while running test cases.

krader1961 added a commit to krader1961/ast that referenced this issue Apr 19, 2018

Unify the unit test framework
This modifies how ksh unit tests are run to have a consistent
environment (i.e., preamble) and post test behavior (i.e., postscript).
There was at least one unit test that did not correctly report the
number of errors via the exit status.

Each test is now run in a unique temporary directory. If the test
doesn't complete without error the temp dir is not removed. This makes
it easier when running the tests on a personal system (rather than, say,
a CI environment like Travis) to explore the state of the unit test.

The `HOME` env var is now set to the temp dir to help keep the test from
modifying the user's environment (e.g., their ~/.sh_history file).

Resolves att#429
Resolves att#477
@siteshwar

This comment has been minimized.

Collaborator

siteshwar commented Apr 19, 2018

Thanks @krader1961 for taking on this. After #481 this should not happen with the current development version. @bitstreamout For now I can only suggest you to disable running test cases in rpm builds.

siteshwar added a commit to siteshwar/ast that referenced this issue Apr 19, 2018

siteshwar added a commit to siteshwar/ast that referenced this issue Apr 19, 2018

siteshwar added a commit to siteshwar/ast that referenced this issue Apr 19, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment