FASM File Overwriting

Now, this was undesirable...

Test #1:
0.Create a folder and go to there.
1.Create a file named "source.asm". In this case it is a very important file for you.
2.Create a file named "source.asm.temp". In this case it is just a temporary file you are testing some modifications or whatever you want.
3.Now assemble the file with fasm "fasm ./source.asm.temp"
4.Result, your original source is not your source anymore. Overwritten by FASM. o_O

Test #2:
0.Create a folder and go to there.
1.Create a file named "source". In this case it is a very important file for you.
2.Now assemble the file with fasm "fasm ./source"
3.Result, your original source is not your source anymore. Overwritten by FASM. o_O

While the auto overwrite functionality is welcome most of the time, I thought it would be nice to handle it with an extra care. D:

I thought it would create a file called "test" (Test #1), because "exe" files usually do not have any extension while most source files have. D:

I had the luck it was just a test and that was not an important file.

I will take more care next time. Or maybe start using the "fasm <input> <output>" template, I guess that is why it is there. D:

I apologize for wasting your time reading this.

Last edited by HaHaAnonymous on 15 Mar 2015, 14:35; edited 1 time in total

Hm, interesting problem. It is because in Linux there is no dedicated extension for the executable files.
And I really can't imagine some reasonable way to handle it.
One possible way is to check the executable flag of the rewritten file.
If it is not set, the rewrite should fail. But such approach can fail on file systems that do not support UNIX file permissions - for example, if from Linux you try to compile on FAT or NTFS file system. In this case, depending on file system mounting options both are possible - file to be always rewritten and file to be never rewritten.

P.S. HaHaAnonymous, having "important" files, not backed up is not good at all. I would suggest using some version control system for the important files. This way you can never lost them because of any reason, including hardware faults, bugs and wrongly typed "rm" command. Check Fossil SCM - it is the best tool I ever found for version control. And it is really easy to be used.

I'm not sure how that's happened since the behaviour I observe is ".bin" is the default suffix so the output is "source.asm.bin"; if I try to force no extension I still get "source.asm." (something I'd hit a while ago without an indication of good-/bad-ness http://board.flatassembler.net/topic.php?t=13535). In my case, I was trying to overwrite the source file as part of a shared FASM/C build but since changed to longer naming that avoided the issue.

P.S. HaHaAnonymous, having "important" files, not backed up is not good at all. I would suggest using some version control system for the important files. This way you can never lost them because of any reason, including hardware faults, bugs and wrongly typed "rm" command. Check Fossil SCM - it is the best tool I ever found for version control. And it is really easy to be used.

Thanks for the suggestion.

cod3b453
In my opinion, the "fasm <input> <output>" is the safest route. As nothing unexpected will be overwritten and you can name the way you want it.

You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot vote in polls in this forumYou cannot attach files in this forumYou can download files in this forum