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

Limit filename length for proper functioning #12770

Closed
wants to merge 1 commit into from

Conversation

dgarvit
Copy link
Contributor

@dgarvit dgarvit commented Apr 6, 2019

Fixes #8758.

@dgarvit
Copy link
Contributor Author

dgarvit commented Apr 6, 2019

On running:

$ echo 'writeln("Hello");' > $(perl -e 'print "a"x250').chpl
$ chpl aaa<TAB>.chpl

image

@bradcray bradcray self-requested a review April 16, 2019 00:06
@bradcray
Copy link
Member

Hi @dgarvit: Thanks for tackling this. Unfortunately, I'm still getting failures for long filenames:

$ echo 'writeln("Hello");' > $(perl -e 'print "a"x247').chpl
$ chpl aaa*.chpl
ld: can't open output file for writing '/var/folders/69/jbk0y4q95lq8xhhwpqgwf_rh000bxs/T//chpl-bradc-29161.deleteme/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.tmp.ld_GNZitr', errno=63 for architecture x86_64

@dgarvit
Copy link
Contributor Author

dgarvit commented Apr 16, 2019

This is strange... The snippet you posted seems to be working well on my system, even with 249 characters.
image

@dgarvit
Copy link
Contributor Author

dgarvit commented Apr 16, 2019

Seems like the building procedure is not the same in the 2 scenarios. I used the setchplenv.bash to build the chapel program, which happens to work well. Are you using a different environment?

@bradcray
Copy link
Member

Interesting. I think you must be correct that it depends on the back-end tools used.

My settings are:

$ printchplenv --all --anonymize
CHPL_HOST_PLATFORM: darwin
CHPL_HOST_COMPILER: clang
CHPL_HOST_ARCH: x86_64
CHPL_TARGET_PLATFORM: darwin
CHPL_TARGET_COMPILER: clang
CHPL_TARGET_ARCH: x86_64
CHPL_TARGET_CPU: native
CHPL_LOCALE_MODEL: flat
CHPL_COMM: none
CHPL_TASKS: qthreads
CHPL_LAUNCHER: none
CHPL_TIMERS: generic
CHPL_UNWIND: system *
CHPL_MEM: jemalloc
CHPL_ATOMICS: cstdlib
CHPL_GMP: gmp
CHPL_HWLOC: hwloc
CHPL_REGEXP: re2
CHPL_LLVM: system *
CHPL_AUX_FILESYS: none
CHPL_LIB_PIC: none

and the output when compiling with --print-commands is:

$ chpl aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.chpl --print-commands
clang    -fno-strict-overflow -I/Users/bradc/chapel/third-party/qthread/install/darwin-x86_64-native-clang-none-flat-jemalloc-hwloc/include -I/Users/bradc/chapel/third-party/hwloc/install/darwin-x86_64-native-clang-none-flat/include      -DCHPL_JEMALLOC_PREFIX=chpl_je_ -DCHPL_HAS_GMP -DCHPL_DO_UNWIND -I/Users/bradc/chapel/modules/standard -I/Users/bradc/chapel/modules/packages  -Wall -Werror -Wpointer-arith -Wwrite-strings -Wno-strict-aliasing -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wmissing-format-attribute -Wno-unused -Wno-uninitialized -Wno-pointer-sign -Wno-tautological-compare   -c -o /var/folders/69/jbk0y4q95lq8xhhwpqgwf_rh000bxs/T//chpl-bradc-35989.deleteme/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.tmp.o -I/Users/bradc/chapel/third-party/qthread/install/darwin-x86_64-native-clang-none-flat-jemalloc-hwloc/include -I. -I/Users/bradc/chapel/runtime/include/localeModels/flat -I/Users/bradc/chapel/runtime/include/localeModels -I/Users/bradc/chapel/runtime/include/comm/none -I/Users/bradc/chapel/runtime/include/comm -I/Users/bradc/chapel/runtime/include/tasks/qthreads -I/Users/bradc/chapel/runtime/include/threads/none -I/Users/bradc/chapel/runtime/include -I/Users/bradc/chapel/runtime/include/qio -I/Users/bradc/chapel/runtime/include/atomics/cstdlib -I/Users/bradc/chapel/runtime/include/mem/jemalloc -I/Users/bradc/chapel/third-party/utf8-decoder -I/Users/bradc/chapel/runtime//../build/runtime/darwin/clang/x86_64/arch-native/loc-flat/comm-none/tasks-qthreads/tmr-generic/unwind-system/mem-jemalloc/atomics-cstdlib/hwloc/re2/fs-none/lib_pic-none/include  -I/Users/bradc/chapel/third-party/jemalloc/install/darwin-x86_64-native-clang-none/include -I/Users/bradc/chapel/third-party/gmp/install/darwin-x86_64-native-clang-none/include -I/Users/bradc/chapel/third-party/hwloc/install/darwin-x86_64-native-clang-none-flat/include /var/folders/69/jbk0y4q95lq8xhhwpqgwf_rh000bxs/T//chpl-bradc-35989.deleteme/_main.c 
clang++  -L/Users/bradc/chapel/third-party/qthread/install/darwin-x86_64-native-clang-none-flat-jemalloc-hwloc/lib -Wl,-rpath,/Users/bradc/chapel/third-party/qthread/install/darwin-x86_64-native-clang-none-flat-jemalloc-hwloc/lib -L/Users/bradc/chapel/third-party/jemalloc/install/darwin-x86_64-native-clang-none/lib -Wl,-rpath,/Users/bradc/chapel/third-party/jemalloc/install/darwin-x86_64-native-clang-none/lib -L/Users/bradc/chapel/third-party/gmp/install/darwin-x86_64-native-clang-none/lib -Wl,-rpath,/Users/bradc/chapel/third-party/gmp/install/darwin-x86_64-native-clang-none/lib -L/Users/bradc/chapel/third-party/hwloc/install/darwin-x86_64-native-clang-none-flat/lib -Wl,-rpath,/Users/bradc/chapel/third-party/hwloc/install/darwin-x86_64-native-clang-none-flat/lib -L/Users/bradc/chapel/third-party/re2/install/darwin-x86_64-native-clang-none/lib -Wl,-rpath,/Users/bradc/chapel/third-party/re2/install/darwin-x86_64-native-clang-none/lib   -o /var/folders/69/jbk0y4q95lq8xhhwpqgwf_rh000bxs/T//chpl-bradc-35989.deleteme/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.tmp -L/Users/bradc/chapel/lib/darwin/clang/x86_64/arch-native/loc-flat/comm-none/tasks-qthreads/tmr-generic/unwind-system/mem-jemalloc/atomics-cstdlib/hwloc/re2/fs-none/lib_pic-none /var/folders/69/jbk0y4q95lq8xhhwpqgwf_rh000bxs/T//chpl-bradc-35989.deleteme/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.tmp.o  /Users/bradc/chapel/lib/darwin/clang/x86_64/arch-native/loc-flat/comm-none/tasks-qthreads/tmr-generic/unwind-system/mem-jemalloc/atomics-cstdlib/hwloc/re2/fs-none/lib_pic-none/main.o  -lchpl  -lm -lgmp -ljemalloc -lchpl -lqthread -L/Users/bradc/chapel/third-party/hwloc/install/darwin-x86_64-native-clang-none-flat/lib -lhwloc -lm -lre2 -lpthread 
ld: can't open output file for writing '/var/folders/69/jbk0y4q95lq8xhhwpqgwf_rh000bxs/T//chpl-bradc-35989.deleteme/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.tmp.ld_6kNUWi', errno=63 for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [/var/folders/69/jbk0y4q95lq8xhhwpqgwf_rh000bxs/T//chpl-bradc-35989.deleteme/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.tmp] Error 1
error: compiling generated source

@bradcray bradcray self-assigned this Apr 16, 2019
@daviditen
Copy link
Member

It would be nice to move this error earlier in the compile cycle. We know the file names as early as parsing, so why wait until codegen to error out? I think the error should be moved up to before the file is parsed. On a long compile this could save a lot of frustration.

@dgarvit
Copy link
Contributor Author

dgarvit commented Apr 22, 2019

@bradcray so what we basically need to know is the maximum length of the extension possible. From the example you mentioned, it seems to be 14 (which i m guessing might just be the highest), though we'd have to discover all other possibilities to be sure. Can you help me with how I can do that?

@bradcray
Copy link
Member

I don't have any insight into how to make this airtight short of doing some Google research (e.g., "what is the longest extension a compiler / linker may want to add to my filename?"). I also don't think there's great harm in being slightly conservative in filename length (i.e., I don't think it'll be the case that people frequently want to have filenames longer than 40 characters). That said, the closer we could get to the actual limit, the better.

@bradcray
Copy link
Member

I'm going to close this PR since it didn't work for me and hasn't continued to receive attention. Would be happy to see someone pick it up and run with it more, but I also don't think it's holding anything important up.

@bradcray bradcray closed this May 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Generate user-facing errors for long filenames
4 participants