william@beaglebone:~/ramfs$ cat test.c
#include<stdio.h>

int main()
{
        printf("hello world !\n");
        return 0;
}
william@beaglebone:~/ramfs$ gcc test.c -o test
william@beaglebone:~/ramfs$ la -al test
-bash: la: command not found
william@beaglebone:~/ramfs$ ls -al test
-rwxr-xr-x 1 william william 5047 Mar 25 18:31 test
william@beaglebone:~/ramfs$ umask 022
william@beaglebone:~/ramfs$ test
william@beaglebone:~/ramfs$ umask 0137
william@beaglebone:~/ramfs$ test
william@beaglebone:~/ramfs$ ./test
hello world !
william@beaglebone:~/ramfs$ chmod u+x test
william@beaglebone:~/ramfs$ test
william@beaglebone:~/ramfs$ umask 022
william@beaglebone:~/ramfs$ test
william@beaglebone:~/ramfs$ sudo test
sudo: test: command not found
william@beaglebone:~/ramfs$ umask 0137
william@beaglebone:~/ramfs$ sudo test
sudo: test: command not found
william@beaglebone:~/ramfs$ export PATH=$PATH:/home/william/ramfs/
william@beaglebone:~/ramfs$ test
william@beaglebone:~/ramfs$ echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/home/william/ramfs/

At this point I decided that the executable "test" is a bad choice for some
reason unknown to me.


william@beaglebone:~/ramfs$ mv test.c hello.c
william@beaglebone:~/ramfs$ rm test
william@beaglebone:~/ramfs$ ls -al
total 8
drwxrwxrwt 2 root    root      60 Mar 25 18:36 .
drwxr-xr-x 4 william william 4096 Jan  3 16:16 ..
-rw-r--r-- 1 william william   74 Mar 25 18:26 hello.c
william@beaglebone:~/ramfs$ gcc hello.c -o hello
william@beaglebone:~/ramfs$ hello
-bash: /home/william/ramfs/hello: Permission denied
william@beaglebone:~/ramfs$ chmod +x hello
william@beaglebone:~/ramfs$ hello
-bash: /home/william/ramfs/hello: Permission denied
william@beaglebone:~/ramfs$ sudo hello
sudo: hello: command not found
william@beaglebone:~/ramfs$ ./hello
-bash: ./hello: Permission denied
william@beaglebone:~/ramfs$ chmod u+x hello
william@beaglebone:~/ramfs$ sudo hello
sudo: hello: command not found

oops forgot about umask .  .

william@beaglebone:~/ramfs$ umask 022
william@beaglebone:~/ramfs$ sudo hello
sudo: hello: command not found

d'oh, of course this wont work . . . the executable is not in roots path.

william@beaglebone:~/ramfs$ hello
hello world !
william@beaglebone:~/ramfs$ ./hello
hello world !
william@beaglebone:~/ramfs$

So yes, really weird the executable "test" is not working correctly on this
system, and yes, I ran which test, and in fact . . .


On Fri, Mar 25, 2016 at 6:30 PM, Mike <bellyac...@gmail.com> wrote:

> On 03/25/2016 09:22 PM, William Hermans wrote:
>
> So be a little bit clearer for you folks that are wondering what's going
> on. ~/ti for william on this system is the mount point for an NFS share.
> Both machines have user william, but it is possible that the UID for each
> is different. I've run into this problem before, and it creates all sorts
> of strange behavior. So, I'll write a simple hello world executable
> locally, in tmpfs . . .
>
> Adding symlinks and NFS with a different UID will certainly skew the
> results!
>
> Umask *does* have an effect, it determines what permissions a file gets
> created with, regardless of how you create it.
>
>
> Mike
>
> On Fri, Mar 25, 2016 at 6:17 PM, William Hermans <yyrk...@gmail.com>
> wrote:
>
>> umask has no effect on the current situation. None, period, zip.
>>
>> On Fri, Mar 25, 2016 at 6:16 PM, Mike < <bellyac...@gmail.com>
>> bellyac...@gmail.com> wrote:
>>
>>> On 03/25/2016 09:03 PM, William Hermans wrote:
>>>
>>> william@beaglebone:~/ti$ gcc test.c -o test
>>> william@beaglebone:~/ti$ test
>>> william@beaglebone:~/ti$ ./test
>>> 32.540001
>>>
>>> william@beaglebone:~/ti$ sudo ln -s /home/william/ti/test /usr/bin/test
>>> william@beaglebone:~/ti$ test
>>> william@beaglebone:~/ti$ cd ..
>>> william@beaglebone:~$ test
>>> william@beaglebone:~$ sudo test
>>> 32.540001
>>>
>>> So, it's a permissions issue. . .
>>>
>>> Exactly, yet you haven't show any of the file permissions in your above
>>> foray.
>>>
>>> Again I'll say it umask is largely what controls how permissions are set
>>> when files are created.  This is basic *nix 101...
>>>
>>>
>>> Mike
>>>
>>>
>>> On Fri, Mar 25, 2016 at 5:41 PM, William Hermans < <yyrk...@gmail.com>
>>> yyrk...@gmail.com> wrote:
>>>
>>>> *Nothing at all to do with gcc, reread what I already posted...*
>>>>
>>>>
>>>> Your system, and mine behave nothing alike. For instance if I attempt
>>>> to run an executable without using dot slash prefixed. The executable will
>>>> simple fail silently.
>>>>
>>>> On Fri, Mar 25, 2016 at 5:30 PM, Mike < <bellyac...@gmail.com>
>>>> bellyac...@gmail.com> wrote:
>>>>
>>>>> On 03/25/2016 08:11 PM, William Hermans wrote:
>>>>>
>>>>> Im guessing that perhaps gcc's -o option now days enables the
>>>>> executable bit on the output file ? I haven't looked into that however.
>>>>>
>>>>> Nothing at all to do with gcc, reread what I already posted...
>>>>>
>>>>>
>>>>> Mike
>>>>>
>>>>>
>>>>> On Fri, Mar 25, 2016 at 5:08 PM, William Hermans < <yyrk...@gmail.com>
>>>>> yyrk...@gmail.com> wrote:
>>>>>
>>>>>> No, Mike is absolutely correct. dot's meaning in this context is
>>>>>> current directory, and slash is just a path modifier / separator. Putting
>>>>>> the file in ones $PATH would solve the "problem" of having to use dot 
>>>>>> slash
>>>>>> I've know  this forever, I do not know why I was thinking that chmod +x
>>>>>> would solve that "issue", because it wont.
>>>>>>
>>>>>> I do recall at some point perhaps not too long ago that changing file
>>>>>> permissions to executable was required. But now days this does not seem 
>>>>>> to
>>>>>> be the case . . . I've always in the last several years use ./executable
>>>>>> until I put the executable into my local path . . .
>>>>>>
>>>>>> On Fri, Mar 25, 2016 at 2:19 PM, Mike < <bellyac...@gmail.com>
>>>>>> bellyac...@gmail.com> wrote:
>>>>>>
>>>>>>> On 03/25/2016 02:03 PM, William Hermans wrote:
>>>>>>>
>>>>>>> No chmod needed *IF* you precede the command with a dot slash "./".
>>>>>>> So when you run a regular Linux command do you have to type this dot 
>>>>>>> slash
>>>>>>> ? No because chmod +x is run on the executable at some point . . .
>>>>>>>
>>>>>>> So be nice to fellow group users who actually know what they're
>>>>>>> talking about, and have been on this list a lot longer than you.
>>>>>>>
>>>>>>> Maybe we need to learn what ./ does...  It has absolutely nothing to
>>>>>>> do with a files permissions or whether it's executable or not.  It's 
>>>>>>> use is
>>>>>>> regarding the lack of the current directory "." in one's PATH variable.
>>>>>>> Umask is (largely) what controls what permissions a file is created 
>>>>>>> with.
>>>>>>>
>>>>>>> <mike@pride-n-joy:%7E/test.d$>mike@pride-n-joy:~/test.d$ ls -al
>>>>>>> total 12
>>>>>>> drwxr-xr-x  2 mike mike 4096 Mar 25 17:07 .
>>>>>>> drwxr-xr-x 37 mike mike 4096 Mar 25 16:46 ..
>>>>>>> -rw-r--r--  1 mike mike   78 Mar 25 16:47 hello.c
>>>>>>> <mike@pride-n-joy:%7E/test.d$>mike@pride-n-joy:~/test.d$ umask
>>>>>>> 0022
>>>>>>> <mike@pride-n-joy:%7E/test.d$>mike@pride-n-joy:~/test.d$ gcc -Wall
>>>>>>> -o hello hello.c
>>>>>>> <mike@pride-n-joy:%7E/test.d$>mike@pride-n-joy:~/test.d$ ls -l
>>>>>>> total 12
>>>>>>> -rwxr-xr-x 1 mike mike 6696 Mar 25 17:08 hello
>>>>>>> -rw-r--r-- 1 mike mike   78 Mar 25 16:47 hello.c
>>>>>>> <mike@pride-n-joy:%7E/test.d$>mike@pride-n-joy:~/test.d$ hello
>>>>>>> bash: hello: command not found
>>>>>>> <mike@pride-n-joy:%7E/test.d$>mike@pride-n-joy:~/test.d$ ./hello
>>>>>>> Hello, world!
>>>>>>> <mike@pride-n-joy:%7E/test.d$>mike@pride-n-joy:~/test.d$ umask 0137
>>>>>>> <mike@pride-n-joy:%7E/test.d$>mike@pride-n-joy:~/test.d$ gcc -Wall
>>>>>>> -o hello hello.c
>>>>>>> <mike@pride-n-joy:%7E/test.d$>mike@pride-n-joy:~/test.d$ ls -l
>>>>>>> total 12
>>>>>>> -rw-r----- 1 mike mike 6696 Mar 25 17:09 hello
>>>>>>> -rw-r--r-- 1 mike mike   78 Mar 25 16:47 hello.c
>>>>>>> <mike@pride-n-joy:%7E/test.d$>mike@pride-n-joy:~/test.d$ hello
>>>>>>> bash: hello: command not found
>>>>>>> <mike@pride-n-joy:%7E/test.d$>mike@pride-n-joy:~/test.d$ ./hello
>>>>>>> bash: ./hello: Permission denied
>>>>>>> <mike@pride-n-joy:%7E/test.d$>mike@pride-n-joy:~/test.d$ ls -l
>>>>>>> total 12
>>>>>>> -rw-r----- 1 mike mike 6696 Mar 25 17:09 hello
>>>>>>> -rw-r--r-- 1 mike mike   78 Mar 25 16:47 hello.c
>>>>>>> <mike@pride-n-joy:%7E/test.d$>mike@pride-n-joy:~/test.d$ chmod 0750
>>>>>>> hello
>>>>>>> <mike@pride-n-joy:%7E/test.d$>mike@pride-n-joy:~/test.d$ ls -l
>>>>>>> total 12
>>>>>>> -rwxr-x--- 1 mike mike 6696 Mar 25 17:09 hello
>>>>>>> -rw-r--r-- 1 mike mike   78 Mar 25 16:47 hello.c
>>>>>>> <mike@pride-n-joy:%7E/test.d$>mike@pride-n-joy:~/test.d$ ./hello
>>>>>>> Hello, world!
>>>>>>> <mike@pride-n-joy:%7E/test.d$>mike@pride-n-joy:~/test.d$ umask 022
>>>>>>> <mike@pride-n-joy:%7E/test.d$>mike@pride-n-joy:~/test.d$ umask
>>>>>>> 0022
>>>>>>> <mike@pride-n-joy:%7E/test.d$>mike@pride-n-joy:~/test.d$
>>>>>>>
>>>>>>> Mike
>>>>>>>
>>>>>>>
>>>>>>> On Fri, Mar 25, 2016 at 8:53 AM, Dieter Wirz < <didi.w...@gmail.com>
>>>>>>> didi.w...@gmail.com> wrote:
>>>>>>>
>>>>>>>> On Fri, Mar 25, 2016 at 3:57 PM, Graham Haddock <
>>>>>>>> <gra...@flexradio.com>gra...@flexradio.com> wrote:
>>>>>>>> > Yes.
>>>>>>>> > sudo chmod 755 myprogram
>>>>>>>> > or
>>>>>>>> > sudo chmod 755 myprogram.o
>>>>>>>> >
>>>>>>>> Graham, please do not tell fairy tails on this list!
>>>>>>>>
>>>>>>>> $ echo '#include <stdio.h>' > hello.c
>>>>>>>> $ echo 'int main (void) {  printf ("Hello, world!\n");   return 0;
>>>>>>>> }' >> hello.c
>>>>>>>> $ cat hello.c
>>>>>>>> #include <stdio.h>
>>>>>>>> int main (void) {  printf ("Hello, world!\n");   return 0; }
>>>>>>>> $ gcc -Wall -o hello hello.c
>>>>>>>> $ ./hello
>>>>>>>> Hello, world!
>>>>>>>> $ ls -l
>>>>>>>> total 12
>>>>>>>> -rwxrwxr-x 1 dw dw 7332 Mar 25 16:32 hello
>>>>>>>> -rw-rw-r-- 1 dw dw   80 Mar 25 16:31 hello.c
>>>>>>>> $
>>>>>>>>
>>>>>>>> No chmod needed, no myprogram.o there, why the sudo????
>>>>>>>>
>>>>>>>
>>>>>>>
> --
> For more options, visit http://beagleboard.org/discuss
> ---
> You received this message because you are subscribed to the Google Groups
> "BeagleBoard" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to beagleboard+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to beagleboard+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to