9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: David Morris <lists@morris-clan.net>
To: Fans of the OS Plan 9 from Bell Labs <9fans@cse.psu.edu>
Subject: Re: [9fans] plan9port build failure on Linux (debian)
Date: Mon,  3 Mar 2008 10:27:26 -0700	[thread overview]
Message-ID: <20080303172726.GD28226@morris-clan.net> (raw)
In-Reply-To: <20080303161756.820A71E8C51@holo.morphisms.net>

On Mon, Mar 03, 2008 at 11:17:47AM -0500, Russ Cox wrote:
> > I am trying to install plan9port on a Linux system (Debian),
> > and am getting the following error:
> >
> >     9 yacc -d -s bc bc.y
> >
> >      fatal error:can't create , <nil>:1
> >     mk: 9 yacc -d ...  : exit status=exit(1)
> >     mk: for i in ...  : exit status=exit(1)
>
> The <nil> is just because the error has happened
> very early and yacc hasn't opened the input file yet.
> If you poke around in the code you'll find that
> it was trying to create bc.tab.h (or should have been)
> but somehow this code (stem="bc", FILED = "tab.h"):
>
> 	sprint(buf, "%s.%s", stem, FILED);
> 	fdefine = Bopen(buf, OWRITE);
> 	if(fdefine == 0)
> 		error("can't create %s", buf);
>
> ended up with an empty string in buf instead of bc.tab.h.

At that point in the code, stem is set to "bc" as expected.

> > So, any ideas on how to fix the build process?  The problem
> > stems from yacc.c at line #2173 in the sprint() function.
> > Could I replace that with the standard library sprintf()
> > function as a stop-gap measure?
>
> It would be interesting to know if that makes it work,
> but more interesting would be why the Plan 9 sprint
> is broken.  This is a pretty simple sprint call and should work.

For what its worth, I just added the following lines to
yacc.c at the top of the file:

#include <stdio.h>
#define sprint sprintf

The build of plan9port just completed with no errors, the
problem is somewhere in sprint().

I'll try and find time tonight to test out the plan9port
build to verify it works.  Let me know if I can provide any
other useful information.  I might try tracking down the bug
later this week, but not certain I'll have much time to do
so.

> Can you reproduce the prolem if you just run:
>
> 	cd /usr/local/plan9/src/cmd
> 	9 yacc -s bc bc.y
>
> ?

Yes, I get the exact same output.

> I'm also interested to see the output of:
>
> 	nm /usr/local/plan9/bin/yacc | grep sprint

Here is the result:

    0804fbe0 T sprint

> @erik:
> > once that is fixed, it would be interesting to see if yacc
> > prints a usage statement instead of printing the garbage.
>
> The command line passed in the mkfile has worked in
> thousands of other builds.  Even if stem was nil, buf
> should at least end up being "<nil>.tab.h" or ".tab.h"
> or at the very worst, if %s was broken, ".".

Makes sense.

> I doubt the command line is being misparsed, but
> I don't have any justifiable alternate theories.

My first thought was also the command-line was not being
parsed, but gdb shows stem is set to "bc" as expected.  Its
why I suspect the problem somewhere under sprint().

--David


  reply	other threads:[~2008-03-03 17:27 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-03  4:20 David Morris
2008-03-03  5:23 ` Hongzheng Wang
     [not found]   ` <20080303084557.GA24732@morris-clan.net>
2008-03-03  8:46     ` David Morris
2008-03-03 15:09       ` sqweek
2008-03-03 16:25         ` David Morris
2008-03-03 16:17 ` Russ Cox
2008-03-03 17:27   ` David Morris [this message]
2008-03-03 19:02     ` erik quanstrom
     [not found]       ` <20080303195459.GE28226@morris-clan.net>
2008-03-03 19:56         ` David Morris
2008-03-04  4:42   ` Russ Cox
2008-03-05 16:21     ` Douglas A. Gwyn
2008-03-03 14:10 erik quanstrom

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080303172726.GD28226@morris-clan.net \
    --to=lists@morris-clan.net \
    --cc=9fans@cse.psu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).