Jump to page: 1 2
Thread overview
rdmd and shebang limits
Jan 09, 2014
Andrea Fontana
Jan 09, 2014
Andrea Fontana
Jan 09, 2014
Gary Willoughby
Jan 09, 2014
Jacob Carlborg
Jan 09, 2014
Andrea Fontana
Jan 10, 2014
Andrea Fontana
Jan 10, 2014
Kira Backes
Jan 10, 2014
Jesse Phillips
Jan 10, 2014
Andrea Fontana
January 09, 2014
I've just discovered that shebang line has a (very short) limit. Only 127 bytes are read from line

It means that something like this doesn't work:

#!/usr/bin/rdmd --shebang -I/asdasdasdasd/asdasdasdasd/asdasdasdasd -I/qweqweqweqwe/qweqweqweqwe/qweqweqweqwe/qweqweqweqwe/qweqweqweqwe/qweqweqweqwe/

Is it possible to add a command line switch to read params from a simple file?

For example:


main.d:
#!/usr/bin/rdmd --shebang --params ./rdmd-params.conf
void main() { }

rdmd-params.conf:
-I/asdasdasdasd/asdasdasdasd/asdasdasdasd -I/qweqweqweqwe/qweqweqweqwe/qweqweqweqwe/qweqweqweqwe/qweqweqweqwe/qweqweqweqwe/
January 09, 2014
On Thursday, 9 January 2014 at 11:25:19 UTC, Andrea Fontana wrote:
> I've just discovered that shebang line has a (very short) limit. Only 127 bytes are read from line
>
> It means that something like this doesn't work:
>
> #!/usr/bin/rdmd --shebang -I/asdasdasdasd/asdasdasdasd/asdasdasdasd -I/qweqweqweqwe/qweqweqweqwe/qweqweqweqwe/qweqweqweqwe/qweqweqweqwe/qweqweqweqwe/
>
> Is it possible to add a command line switch to read params from a simple file?
>
> For example:
>
>
> main.d:
> #!/usr/bin/rdmd --shebang --params ./rdmd-params.conf
> void main() { }
>
> rdmd-params.conf:
> -I/asdasdasdasd/asdasdasdasd/asdasdasdasd -I/qweqweqweqwe/qweqweqweqwe/qweqweqweqwe/qweqweqweqwe/qweqweqweqwe/qweqweqweqwe/

Hmmm however that's not a good solution. It would be nice if all what we need was embedded inside the source itself. Any idea?
January 09, 2014
On Thursday, 9 January 2014 at 11:42:32 UTC, Andrea Fontana wrote:
> On Thursday, 9 January 2014 at 11:25:19 UTC, Andrea Fontana wrote:
>> I've just discovered that shebang line has a (very short) limit. Only 127 bytes are read from line
>>
>> It means that something like this doesn't work:
>>
>> #!/usr/bin/rdmd --shebang -I/asdasdasdasd/asdasdasdasd/asdasdasdasd -I/qweqweqweqwe/qweqweqweqwe/qweqweqweqwe/qweqweqweqwe/qweqweqweqwe/qweqweqweqwe/
>>
>> Is it possible to add a command line switch to read params from a simple file?
>>
>> For example:
>>
>>
>> main.d:
>> #!/usr/bin/rdmd --shebang --params ./rdmd-params.conf
>> void main() { }
>>
>> rdmd-params.conf:
>> -I/asdasdasdasd/asdasdasdasd/asdasdasdasd -I/qweqweqweqwe/qweqweqweqwe/qweqweqweqwe/qweqweqweqwe/qweqweqweqwe/qweqweqweqwe/
>
> Hmmm however that's not a good solution. It would be nice if all what we need was embedded inside the source itself. Any idea?

I thought DMD already supports a cmdfile? Look at the command line options.
January 09, 2014
On 2014-01-09 12:25, Andrea Fontana wrote:
> I've just discovered that shebang line has a (very short) limit. Only
> 127 bytes are read from line
>
> It means that something like this doesn't work:
>
> #!/usr/bin/rdmd --shebang -I/asdasdasdasd/asdasdasdasd/asdasdasdasd
> -I/qweqweqweqwe/qweqweqweqwe/qweqweqweqwe/qweqweqweqwe/qweqweqweqwe/qweqweqweqwe/
>
>
> Is it possible to add a command line switch to read params from a simple
> file?
>
> For example:
>
>
> main.d:
> #!/usr/bin/rdmd --shebang --params ./rdmd-params.conf
> void main() { }
>
> rdmd-params.conf:
> -I/asdasdasdasd/asdasdasdasd/asdasdasdasd
> -I/qweqweqweqwe/qweqweqweqwe/qweqweqweqwe/qweqweqweqwe/qweqweqweqwe/qweqweqweqwe/

@cmdfile       read arguments from cmdfile

-- 
/Jacob Carlborg
January 09, 2014
On 1/9/14 3:25 AM, Andrea Fontana wrote:
> I've just discovered that shebang line has a (very short) limit. Only
> 127 bytes are read from line
>
> It means that something like this doesn't work:
>
> #!/usr/bin/rdmd --shebang -I/asdasdasdasd/asdasdasdasd/asdasdasdasd
> -I/qweqweqweqwe/qweqweqweqwe/qweqweqweqwe/qweqweqweqwe/qweqweqweqwe/qweqweqweqwe/
>
>
> Is it possible to add a command line switch to read params from a simple
> file?
>
> For example:
>
>
> main.d:
> #!/usr/bin/rdmd --shebang --params ./rdmd-params.conf
> void main() { }
>
> rdmd-params.conf:
> -I/asdasdasdasd/asdasdasdasd/asdasdasdasd
> -I/qweqweqweqwe/qweqweqweqwe/qweqweqweqwe/qweqweqweqwe/qweqweqweqwe/qweqweqweqwe/

I think that's a shell limitation. I've long had the plan to experiment with it like this: if --shebang is the first argument, rdmd should just read the whole first line and exec() a shell with it. That would solve a variety of issues related to limitations and quoting quirks.

Andrei


January 09, 2014
Yes I read rdmd but I didn't notice @cmd that was on dmd help, my
fault!

However as I said in my second post, probably it won't solve the
problem: shebang is useful if  you can write a "self-contained"
script, something that fits inside a single file.

I agree with Andrei. It would be a good solution for my case and
it shouldn't break anything.


On Thursday, 9 January 2014 at 21:39:09 UTC, Andrei Alexandrescu
wrote:
> On 1/9/14 3:25 AM, Andrea Fontana wrote:
>> I've just discovered that shebang line has a (very short) limit. Only
>> 127 bytes are read from line
>>
>> It means that something like this doesn't work:
>>
>> #!/usr/bin/rdmd --shebang -I/asdasdasdasd/asdasdasdasd/asdasdasdasd
>> -I/qweqweqweqwe/qweqweqweqwe/qweqweqweqwe/qweqweqweqwe/qweqweqweqwe/qweqweqweqwe/
>>
>>
>> Is it possible to add a command line switch to read params from a simple
>> file?
>>
>> For example:
>>
>>
>> main.d:
>> #!/usr/bin/rdmd --shebang --params ./rdmd-params.conf
>> void main() { }
>>
>> rdmd-params.conf:
>> -I/asdasdasdasd/asdasdasdasd/asdasdasdasd
>> -I/qweqweqweqwe/qweqweqweqwe/qweqweqweqwe/qweqweqweqwe/qweqweqweqwe/qweqweqweqwe/
>
> I think that's a shell limitation. I've long had the plan to experiment with it like this: if --shebang is the first argument, rdmd should just read the whole first line and exec() a shell with it. That would solve a variety of issues related to limitations and quoting quirks.
>
> Andrei
January 10, 2014
On Thursday, 9 January 2014 at 11:25:19 UTC, Andrea Fontana wrote:
> I've just discovered that shebang line has a (very short) limit. Only 127 bytes are read from line
>
> It means that something like this doesn't work:
>
> #!/usr/bin/rdmd --shebang -I/asdasdasdasd/asdasdasdasd/asdasdasdasd -I/qweqweqweqwe/qweqweqweqwe/qweqweqweqwe/qweqweqweqwe/qweqweqweqwe/qweqweqweqwe/

If you need to specify import paths, your script is probably fragile and broken on different linux/bsd distributions.

I don't have a solution.
January 10, 2014
On 1/9/14 3:40 PM, Andrea Fontana wrote:
> Yes I read rdmd but I didn't notice @cmd that was on dmd help, my
> fault!
>
> However as I said in my second post, probably it won't solve the
> problem: shebang is useful if  you can write a "self-contained"
> script, something that fits inside a single file.
>
> I agree with Andrei. It would be a good solution for my case and
> it shouldn't break anything.

Submit a bug request so it gets done.

Andrei

January 10, 2014
On Friday, 10 January 2014 at 02:11:27 UTC, Jesse Phillips wrote:
> On Thursday, 9 January 2014 at 11:25:19 UTC, Andrea Fontana wrote:
>> I've just discovered that shebang line has a (very short) limit. Only 127 bytes are read from line
>>
>> It means that something like this doesn't work:
>>
>> #!/usr/bin/rdmd --shebang -I/asdasdasdasd/asdasdasdasd/asdasdasdasd -I/qweqweqweqwe/qweqweqweqwe/qweqweqweqwe/qweqweqweqwe/qweqweqweqwe/qweqweqweqwe/
>
> If you need to specify import paths, your script is probably fragile and broken on different linux/bsd distributions.
>
> I don't have a solution.

It was just an example, of course. It was the easiest way to add some long params :)
January 10, 2014
On Friday, 10 January 2014 at 05:16:19 UTC, Andrei Alexandrescu wrote:
> On 1/9/14 3:40 PM, Andrea Fontana wrote:
>> Yes I read rdmd but I didn't notice @cmd that was on dmd help, my
>> fault!
>>
>> However as I said in my second post, probably it won't solve the
>> problem: shebang is useful if  you can write a "self-contained"
>> script, something that fits inside a single file.
>>
>> I agree with Andrei. It would be a good solution for my case and
>> it shouldn't break anything.
>
> Submit a bug request so it gets done.
>
> Andrei

Done
https://d.puremagic.com/issues/show_bug.cgi?id=11890
« First   ‹ Prev
1 2