Jump to page: 1 2
Thread overview
[Issue 15071] filenames and module names with case-insensitive HFS+
Sep 16, 2015
Sobirari Muhomori
Sep 16, 2015
John Colvin
Sep 17, 2015
Sobirari Muhomori
Sep 17, 2015
John Colvin
Sep 18, 2015
Sobirari Muhomori
Sep 18, 2015
ag0aep6g@gmail.com
Sep 12, 2016
Steve Biedermann
Sep 12, 2016
ag0aep6g@gmail.com
Sep 12, 2016
Steve Biedermann
Sep 12, 2016
ag0aep6g@gmail.com
Dec 17, 2022
Iain Buclaw
September 16, 2015
https://issues.dlang.org/show_bug.cgi?id=15071

--- Comment #1 from Sobirari Muhomori <dfj1esp02@sneakemail.com> ---
>From spec:
---
By convention, package and module names are all lower case. This is because those names can have a one-to-one correspondence with the operating system's directory and file names, and many file systems are not case sensitive. All lower case package and module names will minimize problems moving projects between dissimilar file systems.
---

Also D is case sensitive, so you can't change identifier case and expect it to work.

--
September 16, 2015
https://issues.dlang.org/show_bug.cgi?id=15071

--- Comment #2 from John Colvin <john.loughran.colvin@gmail.com> ---
(In reply to Sobirari Muhomori from comment #1)
> From spec:
> ---
> By convention, package and module names are all lower case. This is because those names can have a one-to-one correspondence with the operating system's directory and file names, and many file systems are not case sensitive. All lower case package and module names will minimize problems moving projects between dissimilar file systems.
> ---
> 
> Also D is case sensitive, so you can't change identifier case and expect it to work.

I don't expect it to work, but I do expect it to fail with a clear error message before link-time.

--
September 17, 2015
https://issues.dlang.org/show_bug.cgi?id=15071

--- Comment #3 from Sobirari Muhomori <dfj1esp02@sneakemail.com> ---
dmd chirplet.d mathutil.d -main

Does this work (lower case)?

--
September 17, 2015
https://issues.dlang.org/show_bug.cgi?id=15071

--- Comment #4 from John Colvin <john.loughran.colvin@gmail.com> ---
(In reply to Sobirari Muhomori from comment #3)
> dmd chirplet.d mathutil.d -main
> 
> Does this work (lower case)?

Yes.

--
September 18, 2015
https://issues.dlang.org/show_bug.cgi?id=15071

--- Comment #5 from Sobirari Muhomori <dfj1esp02@sneakemail.com> ---
So whether it works or not depends on how you invoke the compiler and not on the file name.

--
September 18, 2015
https://issues.dlang.org/show_bug.cgi?id=15071

ag0aep6g@gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ag0aep6g@gmail.com

--- Comment #6 from ag0aep6g@gmail.com ---
(In reply to John Colvin from comment #2)
> I don't expect it to work, but I do expect it to fail with a clear error message before link-time.

Do you have a suggestion on how that should be realized?

Module chirplet asks for module mathutil, so the compiler gets it. Then a different module mathUtil is compiled as is requested on the command line. Module mathutil has never been compiled and is missing when linking.

I see one way to catch this earlier: dmd could require lower-case file names and/or module names. But I'm not sure if this issue is worth the disruption that would cause. Personally, I wouldn't mind it, though.

--
September 12, 2016
https://issues.dlang.org/show_bug.cgi?id=15071

Steve Biedermann <steve.biedermann.privat@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |steve.biedermann.privat@gma
                   |                            |il.com

--- Comment #7 from Steve Biedermann <steve.biedermann.privat@gmail.com> ---
The same issue occurs on windows.

If you misstype the import, you get link errors instead of dmd import errors.

e.g.:

main.d:
import Bug;

void main()
{
  Bug b = new Bug();
  b.print("test");
}


bug.d:
import std.stdio;

public class Bug {
  void print(string str) {
    writeln(str);
  }
}

compiled with:
dmd main.d

output:
OPTLINK (R) for Win32  Release 8.00.17
Copyright (C) Digital Mars 1989-2013  All rights reserved.
http://www.digitalmars.com/ctg/optlink.html
main.obj(main)
 Error 42: Symbol Undefined _D3Bug3Bug7__ClassZ
main.obj(main)
 Error 42: Symbol Undefined _D3Bug12__ModuleInfoZ
--- errorlevel 2

--
September 12, 2016
https://issues.dlang.org/show_bug.cgi?id=15071

--- Comment #8 from ag0aep6g@gmail.com ---
(In reply to Steve Biedermann from comment #7)
> main.d:
> import Bug;
[...]
> bug.d:
[...]
> compiled with:
> dmd main.d

You have to compile with `dmd main.d bug.d` to see the issue. With just `dmd main.d`, you get a linker error regardless of case sensitivity.

--
September 12, 2016
https://issues.dlang.org/show_bug.cgi?id=15071

--- Comment #9 from Steve Biedermann <steve.biedermann.privat@gmail.com> ---
I see.

Thanks for the clarification.

But then maybe there is something wrong with the file lookup from dub. (Wrong case = link error, correct case = success)

I just tried to compile with rdmd and it seems that rdmd also correctly resolves the file, regardless of the case.

I also tried to specify the -I command line switch for dmd, but it's the same as without (link errors).

--
September 12, 2016
https://issues.dlang.org/show_bug.cgi?id=15071

--- Comment #10 from ag0aep6g@gmail.com ---
(In reply to Steve Biedermann from comment #9)
> But then maybe there is something wrong with the file lookup from dub. (Wrong case = link error, correct case = success)

I don't know how dub works exactly, but if it fails, it probably generates the command line from file names. I.e., it runs `dmd main.d bug.d` and then it hits the issue at hand.

> I just tried to compile with rdmd and it seems that rdmd also correctly resolves the file, regardless of the case.

rdmd generates the command line arguments from the imports. So from main.d and the `import Bug;` in there, rdmd makes `dmd main.d Bug.d`. Case of the import matches case on the command line, so it works.

> I also tried to specify the -I command line switch for dmd, but it's the same as without (link errors).

-I isn't related to this. There's always an implicit `-I.`. dmd needs all source files (or object files) on the command line. It doesn't automatically compile imported modules.

If you need further clarification, please make a thread in the Learn group. Let's not hijack this issue discussion. http://forum.dlang.org/group/learn

--
« First   ‹ Prev
1 2