Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

osx/macos hidden files #649

Closed
lauvergn opened this issue Jan 17, 2022 · 8 comments
Closed

osx/macos hidden files #649

lauvergn opened this issue Jan 17, 2022 · 8 comments
Labels
bug Something isn't working easy Difficulty level is easy and good for starting into this project good first issue Good for newcomers

Comments

@lauvergn
Copy link

Description

Recently, I've sent a fpm project as a tar file to students. One of them open it with a mac and some hidden files, ._xxx.f90, were created.
Then, "fpm build" fails because fpm try to compile the ._xxx.f90 files.
Of course removing the hidden files solves the problem.

Expected Behaviour

Build the executable without removing the hidden files.

Version of fpm

0.40 (osx) and 0.5.0 (linux)

Platform and Architecture

MacOS, linux

Additional Information

No response

@lauvergn lauvergn added the bug Something isn't working label Jan 17, 2022
@awvwgk
Copy link
Member

awvwgk commented Jan 17, 2022

Interesting behaviour, I wasn't aware this could happen.

One option for fpm would be to generally ignore all hidden files, the recursive listing of files currently discovers all files ending in f90. I think we can safely assume that projects hiding their source files don't want to compile those, right?

@lauvergn
Copy link
Author

"I think we can safely assume that projects hiding their source files don't want to compile those, right?", indeed, I was expected that.

@awvwgk
Copy link
Member

awvwgk commented Jan 17, 2022

The source part of a project are collected with

recursive subroutine list_files(dir, files, recurse)

which currently picks up all files. Having it skip hidden files and directories would solve this issue.

Alternatively, we can adapt the filter step here.

fpm/src/fpm_sources.f90

Lines 84 to 87 in 2ae0581

is_source = [(.not.(canon_path(file_names(i)%s) .in. existing_src_files) .and. &
(str_ends_with(lower(file_names(i)%s), fortran_suffixes) .or. &
str_ends_with(lower(file_names(i)%s),[".c",".h"]) ),i=1,size(file_names))]
src_file_names = pack(file_names,is_source)

We should transform the list of source files to their basename and than exclude all hidden files with leading zeros. However, this might be insufficient and still include a hidden directory, i.e. we have to check the canonical path for a pathseparator followed by a dot.

@awvwgk awvwgk added easy Difficulty level is easy and good for starting into this project good first issue Good for newcomers labels Jan 17, 2022
@noisegul
Copy link
Contributor

I'd like to give this issue a try, if it is still free to be assigned.

@awvwgk
Copy link
Member

awvwgk commented Jan 26, 2022

@noisegul sure, feel free to send a patch for this issue. Let us know if you are stuck or need help at any point.

@noisegul
Copy link
Contributor

Will do, thanks.

@noisegul
Copy link
Contributor

noisegul commented Jan 28, 2022

@awvwgk Alright, opened a PR.

@awvwgk
Copy link
Member

awvwgk commented Feb 13, 2022

Fixed by #654. Thanks, @noisegul.

@awvwgk awvwgk closed this as completed Feb 13, 2022
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working easy Difficulty level is easy and good for starting into this project good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants