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

[os] fix #10017 regression, fix #10025 regression #10018

Merged
merged 2 commits into from
Dec 18, 2018

Conversation

timotheecour
Copy link
Member

@timotheecour timotheecour commented Dec 16, 2018

@Araq
Copy link
Member

Araq commented Dec 17, 2018

But then what does "" mean? And why does "" not compare equal to "."?

@timotheecour
Copy link
Member Author

timotheecour commented Dec 17, 2018

But then what does "" mean? And why does "" not compare equal to "."?

"" means un-initialized. It should never ever mean "current directory"

try:

ls ""
ls: cannot access '': No such file or directory

it will be a source of endless, possibly dangerous, bugs otherwise.
see also @krux02 's comment #10017 (comment) and the fact that pretty much all languages I use (D, python, C++, node JS, go) don't do that mistake, as I explained here #10017 (comment) (including Nim up till that recent regression)

yet another example: in python:

os.path.exists('.')
True
os.path.exists('')
False

liekwise with D:

rdmd --eval 'writeln(exists(""));'
false
rdmd --eval 'writeln(exists("."));'
true

etc...

lib/pure/pathnorm.nim Outdated Show resolved Hide resolved
@timotheecour
Copy link
Member Author

timotheecour commented Dec 18, 2018

/cc @Araq @krux02 @dom96

2 birds, one stone! latest commit also fixes #10025

@timotheecour timotheecour changed the title [os] fix #10017 regression [os] fix #10017 regression, fix ##10025 regression Dec 18, 2018
@timotheecour timotheecour changed the title [os] fix #10017 regression, fix ##10025 regression [os] fix #10017 regression, fix #10025 regression Dec 18, 2018
@Araq
Copy link
Member

Araq commented Dec 18, 2018

Ok, sometimes it's easy to convince me. Thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants