Take for an example this question:
I am trying to autograde some work submitted by others. Say an executable is called foo. It is supposed to write to standard out but in some cases, annoyingly, it instead opens a file and writes to that instead.
Is there some way (in linux) of running foo so that all its output, no matter if written to a file or to standard out, is piped to standard out?
I know that this can be done with LD_PRELOAD
, but neither do I have the exact knowledge of how to do so, nor do I know whether there might be a better way.
I guess at some point, someone will come along and provide an answer involving LD_PRELOAD
(or a possibly better solution), so I could just ignore this. But I could also leave a comment like:
This can be done using
LD_PRELOAD
; it is however ugly and may be hard to get right.
This would allow the asker to go for searching for LD_PRELOAD
system call wrapper examples by him/herself. If (s)he is successful, there would be help provided, but there is a risk that the question remains unanswered, because the asker does not bother to write a lengthy answer describing what code was written in the end.
Should I or should I not leave such comments? Are they discouraged for this or other reasons?