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

remove Xs from constructed mktemp templates #59

Merged
merged 2 commits into from
Aug 9, 2017

Conversation

jhoblitt
Copy link
Member

@jhoblitt jhoblitt commented Aug 8, 2017

No description provided.

@jhoblitt
Copy link
Member Author

jhoblitt commented Aug 8, 2017

Travis is having trouble again today, so we're still waiting on CI to know if this is good -- @jdswinbank do you want to give this concept a quick look-over?

#
# XXX GNU mktemp will complain about extra Xs in the filename that are too
# small of a consecutive sequence to constitute a legal template.
tmpfile=$(mktemp -t "XXXXXXXX.${safe_miniconda_file_name/X/_}")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be miniconda_file_name?

Should be ${miniconda_file_name//X/_} (to guard against multiple occurrences of X in the filename)?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ugh. Mangled rebase.

@@ -458,7 +461,7 @@ miniconda::lsst_env() {
conda_opts='--quiet'
fi

tmpfile=$(mktemp -t "${conda_packages}.XXXXXXXX")
tmpfile=$(mktemp -t "${conda_packages/X/_}.XXXXXXXX")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

${conda_packages//X/_}?

# the miniconda installer seems to complains if the filename does not end
# with .sh
tmpfile=$(mktemp -t "XXXXXXXX.${miniconda_file_name}")
# XXX the miniconda installer seems to complains if the filename does not
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the XXX business about?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is emphasis that we're working around what is arguably a bug in the miniconda installer.


# "stub" out cmd to prevent curl from being run
# shellcheck disable=SC2034
cmd="echo"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I realise you're not adding cmd to newinstall.sh here, just taking advantage of it. However, it did cause me a moment of confusion before I worked out that it is supposed to be undefined in normal operation. Worth a comment?

Copy link
Member Author

@jhoblitt jhoblitt Aug 9, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is commented in newinstall.sh: https://github.com/lsst/lsst/blob/master/scripts/newinstall.sh#L933-L939 -- I'm not sure what else could be noted here that would be helpful.

cmd="echo"

# test expected usage
miniconda::install 3 4.2.12 /dne
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/dne is just an (ignored) prefix, right? I first looked for it as some sort of argument to the miniconda installer. Worth a comment?

Copy link
Member Author

@jhoblitt jhoblitt Aug 9, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is a required argument to the miniconda::install function which, is passed on to the miniconda installer. The value doesn't matter at this point since cmd has been stubbed out.

GNU mktemp will complain about extra Xs in the filename that are too
small of a consecutive sequence constitute a legal template.

Eg.:

    $ mktemp --version
    mktemp (GNU coreutils) 8.27
    Copyright (C) 2017 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.

    Written by Jim Meyering and Eric Blake.
    $ mktemp -t XXXXX.Miniconda2-4.2.12-MacOSX-x86_64.sh
    mktemp: too few X's in template ‘XXXXX.Miniconda2-4.2.12-MacOSX-x86_64.sh’
@jhoblitt jhoblitt merged commit 9e87fba into lsst:master Aug 9, 2017
@jhoblitt jhoblitt deleted the tickets/DM-11444-mktemp branch August 9, 2017 17:35
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.

None yet

2 participants