flat assembler
Message board for the users of flat assembler.
Index
> Linux > environment variable Goto page 1, 2 Next |
Author |
|
crc 16 Jul 2004, 22:40
Try this at a BASH shell:
Code: export myinc=/home/myloginname/winasm/include As to making the output file executable, just write a simple shell script like this: Code: #!/bin/bash /path/to/fasm $1 $2 chmod +x $2 I keep FASM in my home directory, and this script in /usr/bin. I named the script 'fasm', and it takes the exact same syntax as the fasm program itself. |
|||
16 Jul 2004, 22:40 |
|
chorus 17 Jul 2004, 01:55
crc, Thank you very much for your help. That answered my quesitons exactly, and both solutions work great.
--Chorus |
|||
17 Jul 2004, 01:55 |
|
fasm9 17 Jul 2004, 13:04
my umask is 077, By default, why software compiled by gcc set 700 and why software compiled by FASM set 600?
Is it because FASM is not linked with glibc??(i.e., not dynamic executable) -- debian:~#cat /usr/bin/s #!/bin/sh /bin/chmod -R 700 /home/* /root/* /etc/* debian:~#cat /root/.profile (or .bashrc) .. umask 077 .. Last edited by fasm9 on 18 Jul 2004, 00:03; edited 1 time in total |
|||
17 Jul 2004, 13:04 |
|
crc 17 Jul 2004, 20:24
The modes set by chmod determine permissions for various people: owner, group, world. The table would be something like this:
Code: owner group world ------------------------------ 4) | | | Read 2) | | | Write 1) | | | Execute ------------------------------ TOTAL: So 077 would be: Code: owner group world ------------------------------ 4) | x | x | Read 2) | x | x | Write 1) | x | x | Execute ------------------------------ TOTAL: 0 7 7 700 = owner can read/write/execute 300 = owner can write/execute. To actually run the file, you need to be able to read it as well as execute it. Most files you create will be set to 677 (owner read/write, others can read/write/execute). Directories need the 'execute' setting as well, IIRC. To play with this online, try here: http://www.classical-webdesigns.co.uk/whatchmod.html You'll need JavaScript, but it helps when learning the ropes |
|||
17 Jul 2004, 20:24 |
|
fasm9 17 Jul 2004, 22:35
ok my mistake, 300(x) -> 600(o)
question again, compiled program by gcc set 700, compiled program by FASM set 600, why is that?? |
|||
17 Jul 2004, 22:35 |
|
scientica 17 Jul 2004, 22:39
check the umask, 777 is golden.
Pardon the forum spamming, but here is an explanation of the umask and it's realtion to the permissions of a file, please pay attension to post #3 #3 wrote: This is a standard Unix thing. Umask doesn't turn on permissions, it only http://dbforums.com/t845153.html Quote: actual_mode = create_mode & ~umask Code: ; in fasm: mov ecx, [umask] mov eax, [create_mode] not ecx and eax, ecx mov [actaul_mode], eax [edit]here's a nice page on permissions (though, s/\+/or/ if you're not thinking boolean algebra +): http://www.dynamic-apps.com/unix_filepermissions.jsp [/edit] |
|||
17 Jul 2004, 22:39 |
|
fasm9 17 Jul 2004, 22:52
scientica wrote:
here, i don't care umask, only interest in FASM behavior. gcc compiling hello.c set 700 by default. FASM compiling hello.asm set 600 by default. why gcc and FASM doing different? not implement something in FASM? |
|||
17 Jul 2004, 22:52 |
|
scientica 17 Jul 2004, 23:11
oh my misstake, it should be 700 (-rwx------) too. (though IMO 776 is better (-rwxrwxrw-))
|
|||
17 Jul 2004, 23:11 |
|
fasm9 17 Jul 2004, 23:36
debian:~#gcc hello.c -o hello
debian:~#ls -l hello -rwx------ .. .. .. hello debian:~#FASM hi.asm hi debian:~#ls -l hi -rw------- .. .. .. hi ? ! -- debian:~#ldd hello debian:~#ldd hi |
|||
17 Jul 2004, 23:36 |
|
crc 17 Jul 2004, 23:40
FASM does not set execute permissions for some reason. You need to do 'chmod +x filename' to set them. (Which is the reason I wrote the simple shell script shown earlier).
|
|||
17 Jul 2004, 23:40 |
|
fasm9 18 Jul 2004, 00:01
can you tell me the detail?
-- Edit: it clearly 600 only happen to FASM, not in ld. |
|||
18 Jul 2004, 00:01 |
|
crc 18 Jul 2004, 00:13
You'd have to modify system.inc with the correct mode numbers, and I'm not sure where or what to modify right now. The easiest solution is to use the shell script I posted earlier.
|
|||
18 Jul 2004, 00:13 |
|
fasm9 18 Jul 2004, 00:32
Thanks for the detail.
i think this is (FASM ,me) one step toward linux. about script, i will use s(in previous post) with cron or anacron but not _at_(suck!). because usually, i am using yet another tools. -- http://www.cfengine.org |
|||
18 Jul 2004, 00:32 |
|
scientica 18 Jul 2004, 21:53
ok, yet again I've gone berseek with diff
Here is a little patch that should fix the permissions, it will (if the umask is 0002) set the permission to -rwxrwxr-x (or -rwxr-xr-x if the umask is 0022). The "open permission" is no set to: S_IRWXU or S_IRWXG or (S_IROTH or S_IXOTH) Also, I added three forgotten symbols: S_IRWXU = 0700o S_IRWXG = 0070o S_IRWXO = 0007o as per ``man 2 open" man 2 open - exceprts wrote:
apply the patch like this (or by hand ): Code: cd /fasm/root/ # the dir where the subdir "source" resides bzcat /path/to/patch/permission_fix_a.patch.bz2 | patch -p1
_________________ ... a professor saying: "use this proprietary software to learn computer science" is the same as English professor handing you a copy of Shakespeare and saying: "use this book to learn Shakespeare without opening the book itself. - Bradley Kuhn |
|||||||||||
18 Jul 2004, 21:53 |
|
fasm9 18 Jul 2004, 22:12
Thanks ;)
Before Edit: i was asking another link for S' patch, because my elinks 0.9.2rc2 won't work well with phpBB. click the link then downloading "download.php". Edit: never mind debian:~#vi system.inc [type]219G[/type] [insert] ..S_IXUSR+.. [type]:wq[/type] debian:~#fasm fasm.asm fasm debian:~#rm /usr/local/bin/fasm debian:~#chmod 700 fasm debian:~#cp fasm /usr/local/bin/ -- BTW, This is intentional to set 600, Right? |
|||
18 Jul 2004, 22:12 |
|
scientica 19 Jul 2004, 15:16
??? "[insert] ..S_IXUSR+.. " ???
this is the patch: Code: diff --unified --recursive --new-file a/source/Linux/system.inc b/source/Linux ystem.inc --- a/source/Linux/system.inc 2004-07-18 23:35:10.000000000 +0200 +++ b/source/Linux/system.inc 2004-07-18 23:35:17.000000000 +0200 @@ -17,12 +17,15 @@ S_ISUID = 4000o S_ISGID = 2000o S_ISVTX = 1000o +S_IRWXU = 0700o S_IRUSR = 0400o S_IWUSR = 0200o S_IXUSR = 0100o +S_IRWXG = 0070o S_IRGRP = 0040o S_IWGRP = 0020o S_IXGRP = 0010o +S_IRWXO = 0007o S_IROTH = 0004o S_IWOTH = 0002o S_IXOTH = 0001o @@ -216,7 +219,7 @@ mov eax,5 mov ebx,buffer mov ecx,O_CREAT+O_TRUNC+O_WRONLY - mov edx,S_IRUSR+S_IWUSR+S_IRGRP + mov edx,S_IRWXU or S_IRWXG or (S_IROTH or S_IXOTH) int 0x80 pop ebp edi esi test eax,eax ("-" = remove line, "+" = "add line" (wothout the leading [\+-] )) |
|||
19 Jul 2004, 15:16 |
|
fasm9 19 Jul 2004, 19:30
scientica wrote: edx,S_IRUSR+S_IWUSR+S_IRGRP to me, only change like this and it works! i didn't touch any other thing in system.inc except this. edx,S_IRUSR+S_IWUSR+S_IXUSR+S_IRGRP -- PS: maybe this also works too! edx,S_IRUSR+S_IWUSR+S_IXUSR ;line number 219 in system.inc |
|||
19 Jul 2004, 19:30 |
|
scientica 19 Jul 2004, 20:49
you're only (potentially - pending on umask) setting -rwx-r-----, it's about equal to "S_IRWXU or S_IRGRP"
|
|||
19 Jul 2004, 20:49 |
|
fasm9 19 Jul 2004, 20:52
debian:~#fasm hello.asm hello
debian:~#ls -l hello -rwx------ .. .. .. hello -- PS: This set(700) is enough to me. i don't have to serve to anyone else but me. |
|||
19 Jul 2004, 20:52 |
|
Goto page 1, 2 Next < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.