mirror of
https://github.com/xcat2/confluent.git
synced 2026-09-02 15:36:05 +00:00
ce870f4c30
A path a caller wants confluent to save something into was being run through the check meant for a file confluent is asked to read. That check forks, drops to the calling user and asks os.access for R_OK, which is false for every file that does not exist yet, so nodesupport servicedata and save_licenses could only be given a path that was already there. Handed a name to create, they refused, and refused in a way no caller was looking for, so the command printed nothing and exited zero. The previous commit worked around it by skipping the check for a download target, which fixed the symptom by removing the guard rather than by asking the right question. Ask the right question instead: whether the user could have created the file in that directory themselves. A path that is already a directory is a destination directory, anything else names the file, which is the same rule the code that goes on to write the file follows. So a caller can still only make confluent write where they could have written, and this now also catches an unwritable destination at the point the request is made rather than several layers further in.