Cynosureprime / rling

RLI Next Gen (Rling), a faster multi-threaded, feature rich alternative to rli found in hashcat utilities.
MIT License
81 stars 11 forks source link

feature: exit early if output file is impossible (subdir doesn't exist) #46

Closed roycewilliams closed 11 months ago

roycewilliams commented 11 months ago

It would be helpful for users if rling could check early for situations where the output file can't be created (for example, if a specified subdirectory doesn't exist). Today, this check is only performed during the final rling stage, at the actual creation time:

Can't create: [bad-subdir]/outfilename: No such file or directory

Waffle2 commented 11 months ago

While I understand the idea, it is difficult to do without losing capabilities.

For example, how would you "test" for named pipes or devices?

It would also break the quite useful feature of using the same filename for input and output.

If you can think of a way to support this, and not break devices/named pipes/identical files....

roycewilliams commented 11 months ago

I'm not sure how the development aspect would play out in practice, but naively ... first checking to see that if the output file is not stdin, not stdout, not a named pipe (test -p), and doesn't already exist are all possible, at which point briefly trying to create (or even touch) the requested output file would fail? And if a check is performed against dynamic named pipe, that the error returned would be different enough to detect?

Waffle2 commented 11 months ago

Destroying the input file (if you name input and output the same) is probably not ideal behaviour.

I don't think there is a way to ensure that the output can be written without actually writing it. Even then, what happens when the disk gets full... There are no good solutions that I can think of.