Stream: committers
Topic: Publisher and c:\temp
Linda (Dec 16 2020 at 22:33):
I just downloaded a new version of publisher today and started getting the following error. Is writing to c:\temp something new? My system is very locked down and I don't have access to that folder so assume that is the issue but insight appreciated (Note that before update all was working fine) C:\Users\lmicha2\Downloads\deqm>_genonce
Checking internet connection...
Reply from 104.196.166.17: bytes=32 time=95ms TTL=115
We're online
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8
Exception in thread "main" java.io.FileNotFoundException: c:\temp\fhir-ig-publisher-tmp.log (Access is denied)
at java.base/java.io.FileOutputStream.open0(Native Method)
at java.base/java.io.FileOutputStream.open(FileOutputStream.java:298)
at java.base/java.io.FileOutputStream.<init>(FileOutputStream.java:237)
at java.base/java.io.FileOutputStream.<init>(FileOutputStream.java:126)
at org.hl7.fhir.igtools.publisher.utils.PublisherConsoleLogger.start(PublisherConsoleLogger.java:27)
at org.hl7.fhir.igtools.publisher.Publisher.main(Publisher.java:8281)
Press any key to continue . . .
If I am understanding correctly, I will see if I can get access to c:\temp...
Lynn Laakso (Dec 16 2020 at 22:46):
yes, that's pretty new
Jose Costa Teixeira (Dec 16 2020 at 23:27):
@Grahame Grieve
Lynn Laakso (Dec 17 2020 at 00:41):
I mean, yes, it is now a requirement that you have the temp directory and yes, it is a recent update
Jean Duteau (Dec 17 2020 at 00:42):
many machines won't have a temp directory or allow unfettered access to a temp directory, so we need to find an alternative
Jean Duteau (Dec 17 2020 at 00:44):
although I will say that I just updated the publisher and ran it on my unix machine and didn't see this error. I changed the user to one who has less permissions and then saw a similar error
John Moehrke (Dec 17 2020 at 01:42):
is the build following the TEMP environment variable, or just hard coded to C:\temp?
John Moehrke (Dec 17 2020 at 01:45):
it seems to be hard-coded... that is not a good idea. sometimes C: is a read-only drive
Grahame Grieve (Dec 17 2020 at 19:54):
it is a requirement that every machine has a temporary directory, yes.
Grahame Grieve (Dec 17 2020 at 19:54):
I have no idea why it be trying to use c:\temp if it doesn't exist
Grahame Grieve (Dec 17 2020 at 19:56):
no. I see. If you have a c:\temp folder, it will try and use it as the temporary directory. Why do you have one that is not accessible?
Grahame Grieve (Dec 17 2020 at 19:57):
many machines won't have a temp directory or allow unfettered access to a temp directory
Grahame Grieve (Dec 17 2020 at 19:57):
I'm not interested in trying to support machines that don't provide a temporary scratch space
Grahame Grieve (Dec 17 2020 at 19:57):
in the proper place
Vassil Peytchev (Dec 17 2020 at 20:37):
The proper place would be where the corresponding environment variable points to, wouldn't it? To be more precise, java.io.tmpdir
makes a system call that tries to resolve %TEMP% or %TMP% on Windows. On Linux and Mac, java.io.tmpdir
is hardcoded to /tmp
Alternatively, creating a temp directory relative to the base directory the publisher is running could work, I think.
John Moehrke (Dec 17 2020 at 23:29):
Vassil is on the target for my suggestion. You should follow the TEMP environment variable. Some C: drives might have a \temp, yet the TEMP environment variable points at a a much faster medium.
Grahame Grieve (Dec 18 2020 at 01:26):
the code will use java.io.tmp unless it sees a c:\temp, in which case it uses that. Since on windows, the temporary folder is buried deep inside a hidden folder; this is a nightmare place to put a log that you then must ask a user to get you (Microsoft hates users...)
Vassil Peytchev (Dec 18 2020 at 01:57):
Since on windows, the temporary folder is buried deep inside a hidden folder
Yes, by default %TEMP% and %TMP% point to %USERPROFILE%\AppData\Local\Temp
Sounds like the exception should be not only if C:\temp exists, but also if %TEMP% or %TMP% are set to their default values (ending in AppData\Local\Temp)
Jean Duteau (Dec 18 2020 at 02:02):
well, it turns out that on a Mac, the tmp folder is also deep inside a hidden folder :)
java.io.tmpdir = /var/folders/f8/4jjd500570q0jt3h1stsf...
Elliot Silver (Dec 18 2020 at 02:17):
I'd suggest the correct approach is to let the OS put the temp files where the OS wants to put temp files, and telling the user to cd %TMP%
if they want a copy.
Richard Townley-O'Neill (Dec 18 2020 at 02:18):
On my windows machine java.io.tmpdir, %TEMP% and %TMP% all point to %USERPROFILE%\AppData\Local\Temp
Gino Canessa (Dec 18 2020 at 15:25):
Grahame Grieve said:
the code will use java.io.tmp unless it sees a c:\temp, in which case it uses that. Since on windows, the temporary folder is buried deep inside a hidden folder; this is a nightmare place to put a log that you then must ask a user to get you (Microsoft hates users...)
If you want to go that approach, I'd recommend checking CRUD permissions on C:\temp
instead of just existence. It's common to both have that directory and not have permission to write to it.
Grahame Grieve (Dec 18 2020 at 19:47):
It's common to both have that directory and not have permission to write to it
why? bizarre.
Grahame Grieve (Dec 18 2020 at 19:47):
telling the user to cd %TMP% if they want a copy
I'll refer all users to Elliot so you can work them through it
Gino Canessa (Dec 18 2020 at 21:46):
Many orgs have the computers locked down so that everything comes from the User's profile directory - e.g., to allow signing in on any device and having all your files there. The rest of the computer (or at least fixed drives) are all locked for user writing so that users can't 'lose' documents by writing them in the wrong locations.
Not my favorite practice, but it's common enough that I'm not surprised when I run into it.
Elliot Silver (Dec 18 2020 at 22:32):
If it needs to be in an easy to find location, what's wrong with the build directory?
Last updated: Apr 12 2022 at 19:14 UTC