binref / refinery

High Octane Triage Analysis
Other
618 stars 62 forks source link

ef command cannot open relative file path (version 0.6.36) #46

Closed nmantani closed 2 months ago

nmantani commented 2 months ago

Description

ef command of version 0.6.36 cannot open relative file path. Version 0.6.35 does not have this issue.

To Reproduce

$ cd /tmp
$ echo sample > sample.txt
$ ef sample.txt
(00:21:05) failure in ef: exception of type ValueError; 'sample.txt' is not in the subpath of '/tmp' OR one path is relative and the other is absolute.
$ ef ./sample.txt
(00:22:10) failure in ef: exception of type ValueError; 'sample.txt' is not in the subpath of '/tmp' OR one path is relative and the other is absolute.
$ ef ../tmp/sample.txt
(00:24:53) failure in ef: exception of type ValueError; '../tmp/sample.txt' is not in the subpath of '/tmp' OR one path is relative and the other is absolute.
$ ef /tmp/sample.txt
sample
$

Environment


nmantani commented 2 months ago

ef command of version 0.6.36 can open relative file path with the -w option.

$ cd /tmp
$ echo sample > sample.txt
$ ef -w sample.txt
sample
$ ef -w ./sample.txt
sample
$ ef -w ../tmp/sample.txt
sample
$ ef -w /tmp/sample.txt
sample
$
huettenhain commented 2 months ago

Yes I did toy around with that function quite a bit. I have little time next week so I can't promise a quick fix, but I'll try to get on it ASAP.

nmantani commented 2 months ago

Thank you! I can use version 0.6.35 until you will fix it.

huettenhain commented 2 months ago

Luckily, it was a rather straightforward mistake. I added a regression test and fix, will push out a new release as soon as the tests show green.

Donaldduck8 commented 2 months ago

Please wait! I think this fix doesn't address the use case where I'm encountering this same issue:

C:\Users\Donald\repositories\refinery>ef C:\Users\Donald\Desktop\install.log
(10:15:25) failure in ef: exception of type ValueError; 
'\\\\?\\C:\\Users\\Donald\\Desktop\\install.log' is not in the subpath of '\\\\?\\C:\\Users\\Donald\\repositories\\refinery' OR one path is relative and the other is absolute.

In this case, I'm trying to ef a file that's not in a subfolder relative to my CWD.

Windows 11 Python 3.11.9 Up-to-date including bugfix

huettenhain commented 2 months ago

Sorry @Donaldduck8, I move too fast. No worries, I can look into that and push out another release 😅.

huettenhain commented 2 months ago

I will close this one out as 0.6.37 / 58b3590 resolves the original issue. @Donaldduck8 I will track your issue in #47.

nmantani commented 2 months ago

@huettenhain Thank you so much for the quick fix!

huettenhain commented 2 months ago

Sure thing @nmantani but stay tuned for 0.6.38 once I fixed #47 xD