9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] scripts
@ 2005-02-09 13:33 Steve Simon
  0 siblings, 0 replies; 4+ messages in thread
From: Steve Simon @ 2005-02-09 13:33 UTC (permalink / raw)
  To: 9fans

I some scripts I use in /n/sources/steve/rc
caveat emptor

-Steve


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [9fans] #! scripts
  2009-04-09 18:40 ` Richard Miller
@ 2009-04-09 18:56   ` lucio
  0 siblings, 0 replies; 4+ messages in thread
From: lucio @ 2009-04-09 18:56 UTC (permalink / raw)
  To: 9fans

> See exec(2):
>           For a file beginning #!, the arguments passed to the program
>           (/bin/rc in the example above) will be the name of the file
>           being executed, any arguments on the #! line, the name of
>           the file again, and finally the second and subsequent argu-
>           ments given to the original exec call.  The result honors
>           the two conventions of a program accepting as argument a
>           file to be interpreted and argv[0] naming the file being
>           executed.

I always seem to expect a subtly different behaviour from what I get.
In this case, I note now that NetBSD behaves exactly the same, but I
only considered trying it out after you've made me read that passage
for the sixteenth time.  I guess I always read in it what I was hoping
to find.

I guess that means I have nothing to fix.  Not only, but any
extensions I was hoping for are shown to be utterly impractical :-(

Let me go back to ELF...

++L




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [9fans] #! scripts
  2009-04-09 18:28 [9fans] #! scripts lucio
@ 2009-04-09 18:40 ` Richard Miller
  2009-04-09 18:56   ` lucio
  0 siblings, 1 reply; 4+ messages in thread
From: Richard Miller @ 2009-04-09 18:40 UTC (permalink / raw)
  To: 9fans

See exec(2):
          For a file beginning #!, the arguments passed to the program
          (/bin/rc in the example above) will be the name of the file
          being executed, any arguments on the #! line, the name of
          the file again, and finally the second and subsequent argu-
          ments given to the original exec call.  The result honors
          the two conventions of a program accepting as argument a
          file to be interpreted and argv[0] naming the file being
          executed.




^ permalink raw reply	[flat|nested] 4+ messages in thread

* [9fans] #! scripts
@ 2009-04-09 18:28 lucio
  2009-04-09 18:40 ` Richard Miller
  0 siblings, 1 reply; 4+ messages in thread
From: lucio @ 2009-04-09 18:28 UTC (permalink / raw)
  To: 9fans

I'm messing around with /sys/src/9/port/sysproc.c and I may have
distorted it beyond recovery, but I have a feeling this problem isn't
of my own making.

I have:

	; cat /bin/ll
	#!/bin/ls -l
	;

If I invoke ll
	; ll
	--rwxrwxr-x M 9 lucio lucio 13 Jan 31 09:30 /bin/ll
	;

no matter where I invoke it, not what I expect at all.  I also have
(my prompt is actually "term% ", in case it matters):

	; cat /bin/en
	#!/bin/echo -n
	; en
	/bin/en;

Now, the question that makes this all very strange is: how does
/rc/bin/service/tcp17010 which contains:

	#!/bin/cpu -R

actually manage to work?  I have broken it during the course of today,
but using 9pccpu.gz off sources as I did now for confirmation, it
seems to work.

In summary, I think sysproc.c:/^sysexec is doing something wrong with
the script header line.  It is rather confusing code and I'm sure it
was more robust last time I messed with it, probably over a year ago.
I plan to fix it, but I need to understand what's broken first, and
that bit I'm finding hard to do.

Could someone with a stable version of Plan 9 please confirm that it
isn't my mind that has suddenly slipped?

++L

PS: invoking

	; ll .

may give an clearer view of the nature of the problem.




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-04-09 18:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-02-09 13:33 [9fans] scripts Steve Simon
2009-04-09 18:28 [9fans] #! scripts lucio
2009-04-09 18:40 ` Richard Miller
2009-04-09 18:56   ` lucio

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).