ginkgo icon indicating copy to clipboard operation
ginkgo copied to clipboard

relative paths to exec.Cmd in test_suite.go

Open thockin opened this issue 9 years ago • 6 comments

in testsuite.New() ginkgo says:

 86         Path:        relPath(dir),

Later that Path field gets used to construct an exec.Cmd, as the Dir field. The problem (it seems) is that when that Dir is expanded, if your CWD has any symlinks in it, things go sideways. In our case, Path becomes ./../../../../../../other/stuff, but then I get a chdir: no such file or directory and everything fails.

Is there a reason for making this path be relative? I tried just writing the "cleaned and abs'ed" dir into that field instead, and all of our tests seem OK with it. Can we change this?

thockin avatar May 05 '16 20:05 thockin

This has been opened a year ago and is still affecting developers that use symlinks (myself included). I second Tim's question. Can we change this?

wasylkowski avatar May 29 '17 07:05 wasylkowski

@onsi can you take a look? Thanks!

wasylkowski avatar Jun 01 '17 12:06 wasylkowski

Will try to take a look this week or next. Am trying to carve out a bit more time for Ginkgo this summer.

As always, though, a PR would be appreciated.

onsi avatar Jun 01 '17 15:06 onsi

Hello @thockin @wasylkowski,

Can you please provide some more info to better understand the issue? How can I reproduce it? Can you give an example?

The problems appears when:

  • the CWD itself is a symlink?
  • the CWD contains symlinks? If yes, are the *_test.go files symlinks or a subfolder/package which contains tests is symlink?

Thanks

alamages avatar Jan 26 '18 17:01 alamages

I'm working through the backlog of old Ginkgo issues - apologies as this issue is probably stale now.

I'm adding this to the v2 backlog.

onsi avatar Apr 06 '21 15:04 onsi

I appreciate it's somewhat absurd that I've only just gotten around to this nearly five years later - however after a few attempts I haven't been able to reproduce it. I've made a symlink with a bunch of packages in it and can't get any invocation of ginkgo to fail. If anyone still has context I'd appreciate a little more detail to reproduce.

onsi avatar Oct 06 '21 16:10 onsi