Skip to content

Unexpected behaviour with parent paths #40

Description

@doekman

With PR #38 parent paths were introduced. But in some cases the behaviour is unexpected.

To demonstrate this, I've added the zip-file parent_test.zip with a directory-structure.

# First the behaviour without the parent
cd parent_test
ok   # displays the file `parent_test/.ok`
ok 1 # shows the path `$BASE/parent_test`
ok 2 # shows "Hi, from ./test1.sh"
ok 3 # shows (with header & footer) the contents of the file `parent_test/.ok`

# And now with the parent
cd offspring
ok # shows nothing
ok --parent   # displays the file `parent_test/.ok`; expected
ok --parent 1 # shows the path `$BASE/parent_test/offspring`; expected
ok --parent 2 # shows "Hi, from $BASE/parent_test/test1.sh"; path is expanded, but not unexpected
ok --parent 3 # shows "cat: .ok: No such file or directory"; unexpected

The problem in my opinion is, the line from the .ok-file is changed (with sed) before it is executed. I think the working directory temporary needs to be changed. Something like:

pushd "$(pwd)"
cd $PARENT_PATH"
eval "$line_text"
popd

Also, if I read the source correctly, ok's argument --file is not respected when used together with --parent.

I'm willing to make a PR for this, but first I want to make sure if this is the behaviour we want. @sergiorgiraldo @secretGeek

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions