-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
set TMPDIR variable to soft link pointing to PWD #21419
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
#include "GeneratorInterface/SherpaInterface/interface/SherpackUtilities.h" | ||
#include <unistd.h> | ||
#include <cstdlib> | ||
namespace spu { | ||
|
||
// functions for inflating (and deflating) | ||
|
@@ -153,6 +154,13 @@ void zerr(int ret) | |
/* compress or decompress from stdin to stdout */ | ||
int Unzip(std::string infile, std::string outfile) | ||
{ | ||
std::string tmpdir = getenv("TMPDIR"); | ||
if (tmpdir.size() > 50 ){ | ||
std::string command = "ln -s $PWD "+tmpdir+"/tmp;"; | ||
system(command.c_str()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This does not check if system returns a failure value. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I put printouts and confirm that things get created properly There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A few things to consider in addition to Chris's comment:
As written, if there's a shared There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Dr15Jones @bbockelm investigating a bit further I came across this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. most important, the written data seems to be cleaned up by MPI after use (i.e. if I point |
||
command = tmpdir+"/tmp"; | ||
setenv("TMPDIR",command.c_str(), true); | ||
} | ||
int ret; | ||
FILE *in = fopen(infile.c_str(),"r"); | ||
if (!in) return -1; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hi @perrozzi - could we follow @bbockelm guidance here and first check the size of tmpdir. it seems the maximum total length is 108 for the path - so the check should be just like if (tmpdir.size() > 50 ) { ...} [probably you know better than I how long the sherpa part of that path is going to be ..]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I expect the Sherpa directories to be O(10) chars, cfr https://hypernews.cern.ch/HyperNews/CMS/get/edmFramework/3807/1/1/1.html
I will put >50 just to be on the safe side
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no guarantee that
$TMPDIR
is set, meaning thatgetenv
could result in anullptr
.