Thread overview
D in SUSE Enterprise Linux
May 01, 2018
Vino
May 01, 2018
rikki cattermole
May 01, 2018
Vino
May 01, 2018
Jonathan M Davis
May 01, 2018
Vino
May 01, 2018
Jonathan M Davis
May 01, 2018
rikki cattermole
May 02, 2018
Joakim
May 01, 2018
Hi All,

 Request your help, trying to execute the below program in SUSE Linux but there is no output


Code
#!/usr/bin/env rdmd
import std.stdio;

void main() {
writeln("Test");
}

DMD Version : DMD64 D Compiler v2.079.1
Package installed : dmd-2.079.1-0.openSUSE.x86_64.rpm

Execution 1 : rdmd <program name>  without this #!/usr/bin/env rdmd
Execution 2: ./<program name> with #!/usr/bin/env rdmd + chmod 777 <program name>

Both ways there is on output


From,
Vino.B
May 02, 2018
On 02/05/2018 2:56 AM, Vino wrote:
> Hi All,
> 
>   Request your help, trying to execute the below program in SUSE Linux but there is no output
> 
> 
> Code
> #!/usr/bin/env rdmd
> import std.stdio;
> 
> void main() {
> writeln("Test");
> }
> 
> DMD Version : DMD64 D Compiler v2.079.1
> Package installed : dmd-2.079.1-0.openSUSE.x86_64.rpm
> 
> Execution 1 : rdmd <program name>  without this #!/usr/bin/env rdmd
> Execution 2: ./<program name> with #!/usr/bin/env rdmd + chmod 777 <program name>
> 
> Both ways there is on output
> 
> 
> From,
> Vino.B

Does this work?

$ dmd -run foo.d
May 01, 2018
On Tuesday, 1 May 2018 at 15:04:43 UTC, rikki cattermole wrote:
> On 02/05/2018 2:56 AM, Vino wrote:
>> Hi All,
>> 
>>   Request your help, trying to execute the below program in SUSE Linux but there is no output
>> 
>> 
>> Code
>> #!/usr/bin/env rdmd
>> import std.stdio;
>> 
>> void main() {
>> writeln("Test");
>> }
>> 
>> DMD Version : DMD64 D Compiler v2.079.1
>> Package installed : dmd-2.079.1-0.openSUSE.x86_64.rpm
>> 
>> Execution 1 : rdmd <program name>  without this #!/usr/bin/env rdmd
>> Execution 2: ./<program name> with #!/usr/bin/env rdmd + chmod 777 <program name>
>> 
>> Both ways there is on output
>> 
>> 
>> From,
>> Vino.B
>
> Does this work?
>
> $ dmd -run foo.d

Hi Rikki,

 No, it is not working, rather getting an error, and the user i executed is the root user. if i compile the program as dmd <program name> and then execute it as ./<program name> it works fine, so is rdmd not supported in Linux.

Error:
/tmp/dmd_runqfz3ul: Permission denied

From,
Vino.B
May 01, 2018
On Tuesday, May 01, 2018 15:18:12 Vino via Digitalmars-d-learn wrote:
> On Tuesday, 1 May 2018 at 15:04:43 UTC, rikki cattermole wrote:
> > On 02/05/2018 2:56 AM, Vino wrote:
> >> Hi All,
> >>
> >>   Request your help, trying to execute the below program in
> >>
> >> SUSE Linux but there is no output
> >>
> >>
> >> Code
> >> #!/usr/bin/env rdmd
> >> import std.stdio;
> >>
> >> void main() {
> >> writeln("Test");
> >> }
> >>
> >> DMD Version : DMD64 D Compiler v2.079.1
> >> Package installed : dmd-2.079.1-0.openSUSE.x86_64.rpm
> >>
> >> Execution 1 : rdmd <program name>  without this #!/usr/bin/env
> >> rdmd
> >> Execution 2: ./<program name> with #!/usr/bin/env rdmd + chmod
> >> 777 <program name>
> >>
> >> Both ways there is on output
> >>
> >>
> >> From,
> >> Vino.B
> >
> > Does this work?
> >
> > $ dmd -run foo.d
>
> Hi Rikki,
>
>   No, it is not working, rather getting an error, and the user i
> executed is the root user. if i compile the program as dmd
> <program name> and then execute it as ./<program name> it works
> fine, so is rdmd not supported in Linux.
>
> Error:
> /tmp/dmd_runqfz3ul: Permission denied

That sounds like your /tmp is mounted with noexec. which won't work with rdmd or any other program that expects to be able to create a file in /tmp and run it. Presumably, you'll need to change the settings in /etc/fstab so that /tmp is not mounted with noexec.

- Jonathan M Davis

May 01, 2018
On Tuesday, 1 May 2018 at 15:42:38 UTC, Jonathan M Davis wrote:
> On Tuesday, May 01, 2018 15:18:12 Vino via Digitalmars-d-learn wrote:
>> On Tuesday, 1 May 2018 at 15:04:43 UTC, rikki cattermole wrote:
>> > On 02/05/2018 2:56 AM, Vino wrote:
>> >> [...]
>> >
>> > Does this work?
>> >
>> > $ dmd -run foo.d
>>
>> Hi Rikki,
>>
>>   No, it is not working, rather getting an error, and the user i
>> executed is the root user. if i compile the program as dmd
>> <program name> and then execute it as ./<program name> it works
>> fine, so is rdmd not supported in Linux.
>>
>> Error:
>> /tmp/dmd_runqfz3ul: Permission denied
>
> That sounds like your /tmp is mounted with noexec. which won't work with rdmd or any other program that expects to be able to create a file in /tmp and run it. Presumably, you'll need to change the settings in /etc/fstab so that /tmp is not mounted with noexec.
>
> - Jonathan M Davis

Hi Jonathan,

  Yes the /tmp is mounted with noexec option , we should not change this option as it is a security violation so is there any other way we can make it work, it tried setting the tmp env variable to a local FS which is mounted with the noexec option but it did not work.

From,
Vino.B
May 01, 2018
On Tuesday, May 01, 2018 15:51:14 Vino via Digitalmars-d-learn wrote:
> On Tuesday, 1 May 2018 at 15:42:38 UTC, Jonathan M Davis wrote:
> > On Tuesday, May 01, 2018 15:18:12 Vino via Digitalmars-d-learn
> >
> > wrote:
> >> On Tuesday, 1 May 2018 at 15:04:43 UTC, rikki cattermole wrote:
> >> > On 02/05/2018 2:56 AM, Vino wrote:
> >> >> [...]
> >> >
> >> > Does this work?
> >> >
> >> > $ dmd -run foo.d
> >>
> >> Hi Rikki,
> >>
> >>   No, it is not working, rather getting an error, and the user
> >>
> >> i
> >> executed is the root user. if i compile the program as dmd
> >> <program name> and then execute it as ./<program name> it works
> >> fine, so is rdmd not supported in Linux.
> >>
> >> Error:
> >> /tmp/dmd_runqfz3ul: Permission denied
> >
> > That sounds like your /tmp is mounted with noexec. which won't work with rdmd or any other program that expects to be able to create a file in /tmp and run it. Presumably, you'll need to change the settings in /etc/fstab so that /tmp is not mounted with noexec.
> >
> > - Jonathan M Davis
>
> Hi Jonathan,
>
>    Yes the /tmp is mounted with noexec option , we should not
> change this option as it is a security violation so is there any
> other way we can make it work, it tried setting the tmp env
> variable to a local FS which is mounted with the noexec option
> but it did not work.

Whether it's really a security risk is up for debate, though I'm sure that concerns over that would be why /tmp is mounted with noexec on your system.

Looking at rdmd --help, it does list a --tmpdir flag, so if you have another directory that is not mounted noexec where you would consider it acceptable to have temporary files be created and executed, then you can use --tmpdir to tell rdmd to use it. So, presumably, the shebang line would then be something like

#!/usr/bin/env rdmd --tmpdir=/some/other/tmp/dir

though I haven't tested it.

- Jonathan M Davis

May 02, 2018
On 02/05/2018 3:51 AM, Vino wrote:
> On Tuesday, 1 May 2018 at 15:42:38 UTC, Jonathan M Davis wrote:
>> On Tuesday, May 01, 2018 15:18:12 Vino via Digitalmars-d-learn wrote:
>>> On Tuesday, 1 May 2018 at 15:04:43 UTC, rikki cattermole wrote:
>>> > On 02/05/2018 2:56 AM, Vino wrote:
>>> >> [...]
>>> >
>>> > Does this work?
>>> >
>>> > $ dmd -run foo.d
>>>
>>> Hi Rikki,
>>>
>>>   No, it is not working, rather getting an error, and the user i
>>> executed is the root user. if i compile the program as dmd
>>> <program name> and then execute it as ./<program name> it works
>>> fine, so is rdmd not supported in Linux.
>>>
>>> Error:
>>> /tmp/dmd_runqfz3ul: Permission denied
>>
>> That sounds like your /tmp is mounted with noexec. which won't work with rdmd or any other program that expects to be able to create a file in /tmp and run it. Presumably, you'll need to change the settings in /etc/fstab so that /tmp is not mounted with noexec.
>>
>> - Jonathan M Davis
> 
> Hi Jonathan,
> 
>    Yes the /tmp is mounted with noexec option , we should not change this option as it is a security violation so is there any other way we can make it work, it tried setting the tmp env variable to a local FS which is mounted with the noexec option but it did not work.
> 
> From,
> Vino.B

Modify rdmd to use another directory which is more acceptable for your setup.
May 02, 2018
On Tuesday, 1 May 2018 at 16:02:03 UTC, rikki cattermole wrote:
> On 02/05/2018 3:51 AM, Vino wrote:
>> On Tuesday, 1 May 2018 at 15:42:38 UTC, Jonathan M Davis wrote:
>>> On Tuesday, May 01, 2018 15:18:12 Vino via Digitalmars-d-learn wrote:
>>>> [...]
>>>
>>> That sounds like your /tmp is mounted with noexec. which won't work with rdmd or any other program that expects to be able to create a file in /tmp and run it. Presumably, you'll need to change the settings in /etc/fstab so that /tmp is not mounted with noexec.
>>>
>>> - Jonathan M Davis
>> 
>> Hi Jonathan,
>> 
>>    Yes the /tmp is mounted with noexec option , we should not change this option as it is a security violation so is there any other way we can make it work, it tried setting the tmp env variable to a local FS which is mounted with the noexec option but it did not work.
>> 
>> From,
>> Vino.B
>
> Modify rdmd to use another directory which is more acceptable for your setup.

Or just set an environment variable like TMP, if you don't want to append the flag Jonathan gave each time, as rdmd simply calls std.file.tempDir:

https://dlang.org/phobos/std_file.html#.tempDir