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

Directories named "0" are removed from path by fcm_internal #276

Open
accowa opened this issue Oct 31, 2022 · 2 comments
Open

Directories named "0" are removed from path by fcm_internal #276

accowa opened this issue Oct 31, 2022 · 2 comments
Assignees
Milestone

Comments

@accowa
Copy link

accowa commented Oct 31, 2022

Directories named "0" are unintentionally removed from paths by the internal version of catfile in fcm_internal. This patch will fix the issue:

diff --git FCM/bin/fcm_internal

@@ -520,7 +520,7 @@ sub catfile {
   my $path  = shift @names;

   for my $name (@names) {
-    $path .= '/' . $name if $name;
+    $path .= '/' . $name if ($name or $name eq 0);
   }

   return $path;

when applied to line 537 of the latest version. But it isn't clear why fcm_internal needs local copies of the File::Spec routines at all? Why not use the supported versions which don't have this issue and are already being used in many other parts of the package?

@accowa
Copy link
Author

accowa commented Oct 31, 2022

To provide some context: this feature breaks an attempt to build NEMO in a directory such as:

/working/user/CI/0/nemo/tests/OVERFLOW

source files are preprocessed and compiled in the correct locations but the final linking stage fails because the 'fcm_internal load' section strips out the '0' directory in this call:

    # Name of main object file
    my $mainobj = (basename ($info->{SRC}) eq $info->{SRC})
                  ? catfile (&get_env ('FCM_OBJDIR'), $info->{SRC})
                  : $info->{SRC};

using File::Spec->catfile instead of the local version does not have this issue.

This arose during an attempt to set up a CI test facility where the numbered directories are automatically generated. The NEMO system team can correct this in versions released with NEMO but wish to avoid reoccurrence with future updates.

@dpmatthews dpmatthews self-assigned this Nov 1, 2022
@dpmatthews dpmatthews added this to the next-release milestone Nov 1, 2022
@dpmatthews
Copy link
Member

Thanks for the patch.

it isn't clear why fcm_internal needs local copies of the File::Spec routines at all?

This was done as an optimisation (17 years ago!)
Reducing the number of dependencies for fcm_internal sped up some of our builds considerably.

Note that fcm build has been deprecated since 2011: http://metomi.github.io/fcm/doc/release_notes/2-0.html

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

No branches or pull requests

2 participants