* [9fans] 8c, 8l, and empty files
@ 2009-03-03 20:03 Enrique Soriano
2009-03-03 22:54 ` andrey mirtchovski
2009-03-04 2:16 ` Federico G. Benavento
0 siblings, 2 replies; 13+ messages in thread
From: Enrique Soriano @ 2009-03-03 20:03 UTC (permalink / raw)
To: Fans of the OS Plan 9 from Bell Labs
term% cd /tmp
term% ls nothing.c
ls: nothing.c: 'nothing.c' file does not exist
term% touch nothing.c
term% 8c -FVw nothing.c
term% 8l -o nothing nothing.8
term% echo $status
term% ls -l nothing
--rwxrwxr-x M 8 glenda glenda 0 Mar 3 21:49 nothing
term% ./nothing
./nothing: exec header invalid
Why does the loader work?
Is there any reason to not report an error?
Regards,
Q
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [9fans] 8c, 8l, and empty files
2009-03-03 20:03 [9fans] 8c, 8l, and empty files Enrique Soriano
@ 2009-03-03 22:54 ` andrey mirtchovski
2009-03-03 23:29 ` Enrique Soriano
2009-03-04 2:16 ` Federico G. Benavento
1 sibling, 1 reply; 13+ messages in thread
From: andrey mirtchovski @ 2009-03-03 22:54 UTC (permalink / raw)
To: Fans of the OS Plan 9 from Bell Labs
if nobody replies to your email, would you report an error?
or, if you prefer:
if a linker has nothing to link (in the forest), should everybody hear about it?
:)
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [9fans] 8c, 8l, and empty files
2009-03-03 22:54 ` andrey mirtchovski
@ 2009-03-03 23:29 ` Enrique Soriano
2009-03-03 23:37 ` andrey mirtchovski
` (2 more replies)
0 siblings, 3 replies; 13+ messages in thread
From: Enrique Soriano @ 2009-03-03 23:29 UTC (permalink / raw)
To: Fans of the OS Plan 9 from Bell Labs
On Mar 3, 2009, at 11:54 PM, andrey mirtchovski wrote:
> if nobody replies to your email, would you report an error?
>
> or, if you prefer:
>
> if a linker has nothing to link (in the forest), should everybody
> hear about it?
>
> :)
>
Commands are expected to be loud on errors and silent
on success.
Does it have any sense to create a 0 byte executable file?
Success or failure? Can you execute it?
Q
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [9fans] 8c, 8l, and empty files
2009-03-03 23:29 ` Enrique Soriano
@ 2009-03-03 23:37 ` andrey mirtchovski
2009-03-03 23:41 ` J.R. Mauro
2009-03-03 23:43 ` Anthony Sorace
2009-03-04 12:25 ` Charles Forsyth
2 siblings, 1 reply; 13+ messages in thread
From: andrey mirtchovski @ 2009-03-03 23:37 UTC (permalink / raw)
To: Fans of the OS Plan 9 from Bell Labs
> Does it have any sense to create a 0 byte executable file?
> Success or failure? Can you execute it?
"Garbage-in, Garbage-out"
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [9fans] 8c, 8l, and empty files
2009-03-03 23:37 ` andrey mirtchovski
@ 2009-03-03 23:41 ` J.R. Mauro
2009-03-03 23:45 ` andrey mirtchovski
0 siblings, 1 reply; 13+ messages in thread
From: J.R. Mauro @ 2009-03-03 23:41 UTC (permalink / raw)
To: Fans of the OS Plan 9 from Bell Labs
On Tue, Mar 3, 2009 at 6:37 PM, andrey mirtchovski
<mirtchovski@gmail.com> wrote:
>> Does it have any sense to create a 0 byte executable file?
>> Success or failure? Can you execute it?
>
> "Garbage-in, Garbage-out"
Or perhaps, since the user went to trouble of making sure the file
didn't exist and then creating the empty file, the compiler and linker
felt it would be rude if they didn't do something with it?
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [9fans] 8c, 8l, and empty files
2009-03-03 23:29 ` Enrique Soriano
2009-03-03 23:37 ` andrey mirtchovski
@ 2009-03-03 23:43 ` Anthony Sorace
2009-03-03 23:52 ` andrey mirtchovski
2009-03-04 15:54 ` Juan Céspedes
2009-03-04 12:25 ` Charles Forsyth
2 siblings, 2 replies; 13+ messages in thread
From: Anthony Sorace @ 2009-03-03 23:43 UTC (permalink / raw)
To: Fans of the OS Plan 9 from Bell Labs
i could see this going either way, but from my perspective the linker
did what you told it. it didn't see anything it couldn't recognize,
and didn't find any symbols it wasn't able to resolve. it's a weird
case, certainly, but it doesn't strike me as wrong.
if i were inclined to submit a patch, it'd be to add a note to the
BUGS section of the man page.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [9fans] 8c, 8l, and empty files
2009-03-03 23:41 ` J.R. Mauro
@ 2009-03-03 23:45 ` andrey mirtchovski
2009-03-03 23:57 ` Uriel
0 siblings, 1 reply; 13+ messages in thread
From: andrey mirtchovski @ 2009-03-03 23:45 UTC (permalink / raw)
To: Fans of the OS Plan 9 from Bell Labs
> Or perhaps, since the user went to trouble of making sure the file
> didn't exist and then creating the empty file, the compiler and linker
> felt it would be rude if they didn't do something with it?
you can call Plan 9 whatever you'd like, but don't call it "impolite" :)
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [9fans] 8c, 8l, and empty files
2009-03-03 23:43 ` Anthony Sorace
@ 2009-03-03 23:52 ` andrey mirtchovski
2009-03-04 11:56 ` Enrique Soriano
2009-03-04 15:54 ` Juan Céspedes
1 sibling, 1 reply; 13+ messages in thread
From: andrey mirtchovski @ 2009-03-03 23:52 UTC (permalink / raw)
To: Fans of the OS Plan 9 from Bell Labs
two things: the linker doesn't only produce binaries, it has options
for producing other output in which a null object file may be
applicable; furthermore, it takes more than a single file, so you can
see how a #ifdef-ed C file compiles to nothing (even if it's bad
practice) but then is linked with other parts of the program just
fine.
so, yes. nil input should result in nil output, at least in this case.
would you like a warning? warnings are fun!
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [9fans] 8c, 8l, and empty files
2009-03-03 23:45 ` andrey mirtchovski
@ 2009-03-03 23:57 ` Uriel
0 siblings, 0 replies; 13+ messages in thread
From: Uriel @ 2009-03-03 23:57 UTC (permalink / raw)
To: Fans of the OS Plan 9 from Bell Labs
"Unix never says 'please'"
Nor is it supposed to keep users from doing stupid things... thank
God, or I could not use it.
uriel
On Wed, Mar 4, 2009 at 12:45 AM, andrey mirtchovski
<mirtchovski@gmail.com> wrote:
>> Or perhaps, since the user went to trouble of making sure the file
>> didn't exist and then creating the empty file, the compiler and linker
>> felt it would be rude if they didn't do something with it?
>
> you can call Plan 9 whatever you'd like, but don't call it "impolite" :)
>
>
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [9fans] 8c, 8l, and empty files
2009-03-03 20:03 [9fans] 8c, 8l, and empty files Enrique Soriano
2009-03-03 22:54 ` andrey mirtchovski
@ 2009-03-04 2:16 ` Federico G. Benavento
1 sibling, 0 replies; 13+ messages in thread
From: Federico G. Benavento @ 2009-03-04 2:16 UTC (permalink / raw)
To: Fans of the OS Plan 9 from Bell Labs
I consider that a feature, specially when starting something new
I just touch the files I think I will need and put them in the mkfile
it just works!
On Tue, Mar 3, 2009 at 5:03 PM, Enrique Soriano <esoriano@lsub.org> wrote:
> term% cd /tmp
> term% ls nothing.c
> ls: nothing.c: 'nothing.c' file does not exist
> term% touch nothing.c
> term% 8c -FVw nothing.c
> term% 8l -o nothing nothing.8
> term% echo $status
>
> term% ls -l nothing
> --rwxrwxr-x M 8 glenda glenda 0 Mar 3 21:49 nothing
> term% ./nothing
> ./nothing: exec header invalid
>
>
> Why does the loader work?
> Is there any reason to not report an error?
>
> Regards,
> Q
>
>
--
Federico G. Benavento
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [9fans] 8c, 8l, and empty files
2009-03-03 23:52 ` andrey mirtchovski
@ 2009-03-04 11:56 ` Enrique Soriano
0 siblings, 0 replies; 13+ messages in thread
From: Enrique Soriano @ 2009-03-04 11:56 UTC (permalink / raw)
To: Fans of the OS Plan 9 from Bell Labs
> "Garbage-in, Garbage-out"
What does it happen when you
try to link an object file that
does not have main() defined?
And when you try to link a malformed
object file?
In these cases, there is not any
garbage-out for the garbage-in.
There is an error, as expected.
> two things: the linker doesn't only produce binaries, it has options
> for producing other output in which a null object file may be
> applicable;
In most cases it is used to create a
binary.
> furthermore, it takes more than a single file, so you can
> see how a #ifdef-ed C file compiles to nothing (even if it's bad
> practice) but then is linked with other parts of the program just
> fine.
In the example, I was linking a *unique*
empty object file.
To create a 0 byte exec file,
that is, a binary without
a header, is a nonsense.
Regards,
Q.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [9fans] 8c, 8l, and empty files
2009-03-03 23:29 ` Enrique Soriano
2009-03-03 23:37 ` andrey mirtchovski
2009-03-03 23:43 ` Anthony Sorace
@ 2009-03-04 12:25 ` Charles Forsyth
2 siblings, 0 replies; 13+ messages in thread
From: Charles Forsyth @ 2009-03-04 12:25 UTC (permalink / raw)
To: 9fans
viewing the source code, i suspect it's an oversight rather than essential design.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [9fans] 8c, 8l, and empty files
2009-03-03 23:43 ` Anthony Sorace
2009-03-03 23:52 ` andrey mirtchovski
@ 2009-03-04 15:54 ` Juan Céspedes
1 sibling, 0 replies; 13+ messages in thread
From: Juan Céspedes @ 2009-03-04 15:54 UTC (permalink / raw)
To: Fans of the OS Plan 9 from Bell Labs
On Wed, Mar 4, 2009 at 12:43 AM, Anthony Sorace <anothy@gmail.com> wrote:
> i could see this going either way, but from my perspective the linker
> did what you told it.
The linker has NOT done what it is supposed to do. From the man page:
> These commands load the named files into executable files
> for the corresponding architectures
And, in this case, it has not produced an executable file.
Furthermore, 8l should give an error when there is no function main().
In fact, it shows that error unless there is no function at all in
any .8 input file.
--
Juan Cespedes
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2009-03-04 15:54 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-03 20:03 [9fans] 8c, 8l, and empty files Enrique Soriano
2009-03-03 22:54 ` andrey mirtchovski
2009-03-03 23:29 ` Enrique Soriano
2009-03-03 23:37 ` andrey mirtchovski
2009-03-03 23:41 ` J.R. Mauro
2009-03-03 23:45 ` andrey mirtchovski
2009-03-03 23:57 ` Uriel
2009-03-03 23:43 ` Anthony Sorace
2009-03-03 23:52 ` andrey mirtchovski
2009-03-04 11:56 ` Enrique Soriano
2009-03-04 15:54 ` Juan Céspedes
2009-03-04 12:25 ` Charles Forsyth
2009-03-04 2:16 ` Federico G. Benavento
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).