flat assembler
Message board for the users of flat assembler.
  
|  Index
      > Main > fasm silently overwrites output file with debug info | 
| Author | 
 | 
| revolution 09 Nov 2019, 07:38 You can also try this:     Code: fasm main.asm main.asm -s main.asm     | |||
|  09 Nov 2019, 07:38 | 
 | 
| Tomasz Grysztar 09 Nov 2019, 08:58 This has the same problems that we discussed with "includeonce". The OS abstraction layer that fasm uses has no ability to deal with them in a reliable way. In fact, fasm is not even aware whether the file system uses case-sensitive or case-insensitive names.
 A practical solution could be to write some shell script around fasm, handling things in a way appropriate for a given OS. | |||
|  09 Nov 2019, 08:58 | 
 | 
| revolution 09 Nov 2019, 14:27 dunkaist:
 One way to detect this problem would be to temporarily mark each file as read-only. Fasm could do this itself. Once the input has been read, mark it read-only. Once the binary has been written, mark it as read-only. Then before exiting restore the permissions to the original. If you get a permission error when writing then you know something is wrong. You would have to modify your own copy of fasm to support it. But that wouldn't protect against output redirection: Code: fasm main.asm > main.asm    Last edited by revolution on 09 Nov 2019, 16:28; edited 1 time in total | |||
|  09 Nov 2019, 14:27 | 
 | 
| Tomasz Grysztar 09 Nov 2019, 16:23 revolution wrote: Once the input has been, read mark it read-only. Things like the attributes may also be highly OS-dependent. Good news is that you can implement such tricks entirely within the OS abstraction layer (fasm's "interface") without having to touch the fasm's core. You can make even a highly customized interface which should be able to be assembled with various versions of fasm's core with no problems. | |||
|  09 Nov 2019, 16:23 | 
 | 
| revolution 09 Nov 2019, 16:34 Another possibility is to write the output to a temporary filename and then rename it when it is closed.
 All OSes that I have encountered will fail the rename if another file of the same name already exists. | |||
|  09 Nov 2019, 16:34 | 
 | 
| Tomasz Grysztar 09 Nov 2019, 16:39 revolution wrote: Another possibility is to write the output to a temporary filename and then rename it when it is closed. | |||
|  09 Nov 2019, 16:39 | 
 | 
| < Last Thread | Next Thread > | 
| Forum Rules: 
 | 
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.