www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - rdmd and shebang limits

reply "Andrea Fontana" <nospam example.com> writes:
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/
Jan 09 2014
next sibling parent "Andrea Fontana" <nospam example.com> writes:
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?
Jan 09 2014
prev sibling next sibling parent "Gary Willoughby" <dev nomad.so> writes:
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.
Jan 09 2014
prev sibling next sibling parent Jacob Carlborg <doob me.com> writes:
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
Jan 09 2014
prev sibling next sibling parent reply Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
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
Jan 09 2014
parent Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
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
Jan 09 2014
prev sibling next sibling parent "Andrea Fontana" <nospam example.com> writes:
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

Jan 09 2014
prev sibling next sibling parent "Jesse Phillips" <Jesse.K.Phillips+D gmail.com> writes:
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.
Jan 09 2014
prev sibling next sibling parent "Andrea Fontana" <nospam example.com> writes:
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 :)
Jan 10 2014
prev sibling next sibling parent "Andrea Fontana" <nospam example.com> writes:
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
Jan 10 2014
prev sibling parent "Kira Backes" <kira.backes nrwsoft.de> writes:
I’d be interested in implementing this ticket (since using D in 
scripts seems awesome) as my first contribution to D :-)

If noone else with more experiences grabs it before me, I’ll do it



rgds, Kira
Jan 10 2014