1.9 on OpenBSD

[email protected]$G$9!%e(B

e$B!!e(BOpenBSD e$B>e$Ge(B 1.9
e$B$r%3%s%Q%$%k$7$?$i!$$3$s$J7Y9p$,=P$^$7$?!%$I$&$7e(B
e$B$?$b$s$G$7$g$&!%e(B

gcc -g -O2 -L. -Wl,-E main.o libruby-static.a -lpthread -lm -o
miniruby
libruby-static.a(io.o)(.text+0x3e12): In function rb_io_s_sysopen': ../trunk/io.c:3459: warning: strcpy() is almost always misused, please use strlcpy() libruby-static.a(marshal.o)(.text+0x694): In functionw_float’:
…/trunk/marshal.c:329: warning: sprintf() is often misused, please
use snprintf()
libruby-static.a(parse.o)(.text+0xcff8): In function `rb_id2str’:
…/trunk/parse.y:8563: warning: strcat() is almost always misused,
please use strlcat()

[email protected]$G$9!#e(B

At Wed, 12 Sep 2007 07:10:43 +0900,
SASADA Koichi wrote in [ruby-dev:31775]:

e$B!!e(BOpenBSD e$B>e$Ge(B 1.9 e$B$r%3%s%Q%$%k$7$?$i!$$3$s$J7Y9p$,=P$^$7$?!%$I$&$7e(B
e$B$?$b$s$G$7$g$&!%e(B

OpenBSDe$B$,JP<9E*$H$$$&[email protected]$1$N$h$&$J!#e(B

gcc -g -O2 -L. -Wl,-E main.o libruby-static.a -lpthread -lm -o
miniruby
libruby-static.a(io.o)(.text+0x3e12): In function `rb_io_s_sysopen’:
…/trunk/io.c:3459: warning: strcpy() is almost always misused,
please use strlcpy()

e$B$3$3$G$OI,MW$JD9$5$r3d$jEv$F$F$+$i%3%T!<$7$F$$$k$N$G!“e(Bstrcpye$B$G$be(B
e$BLdBj$O$J$$$O$:$G$9!#$`$7$mLdBj$O$=$NA0$Ne(Ballocae$B$K$”$C$F!"MF0W$Ke(B
stack overflowe$B$r5/$3$;$^$9!#e(B

$ ruby19 -e ‘IO.sysopen(“x”*10_000_000)’
e$B%;%0%a%s%F!<%7%g%s0cH?$G$9e(B (core dumped)

libruby-static.a(marshal.o)(.text+0x694): In function `w_float’:
…/trunk/marshal.c:329: warning: sprintf() is often misused, please
use snprintf()

e$B$3$A$i$OFbIt$G>e8B$N7h$^$C$F$$$k$b$N$J$N$G!"$H$s$G$b$J$/e(Bdoublee$B$Ne(B
e$B7e?t$NBg$-$$e(B(doublee$B$,e(B300bite$B0J>e$"$k$h$&$Je(B)e$B4D6-$G$J$$8B$jLdBj$O$Je(B
e$B$$$O$:$G$9!#e(B

libruby-static.a(parse.o)(.text+0xcff8): In function `rb_id2str’:
…/trunk/parse.y:8563: warning: strcat() is almost always misused,
please use strlcat()

e$B$3$l$be(Brb_io_s_sysopene$B$HF1MM$G$7$g$&!#e(B

e$B$A$J$_$K!“e(Brb_str_cat()e$B$J$I$N0z?t$K$”$ke(Bchar*e$B$N%(%s%3!<%G%#%s%0$Oe(B
e$B$I$&$J$k$s$G$7$g$&$+!#e(BASCII?

Index: io.c

— io.c (revision 13429)
+++ io.c (working copy)
@@ -3456,6 +3456,6 @@ rb_io_s_sysopen(int argc, VALUE *argv)
else fmode = NUM2INT(perm);

  • path = ALLOCA_N(char, strlen(RSTRING_PTR(fname))+1);
  • strcpy(path, RSTRING_PTR(fname));
  • RB_GC_GUARD(fname) = rb_str_new4(fname);
  • path = RSTRING_PTR(fname);
    fd = rb_sysopen(path, flags, fmode);
    return INT2NUM(fd);
    Index: marshal.c
    ===================================================================
    — marshal.c (revision 13429)
    +++ marshal.c (working copy)
    @@ -310,5 +310,5 @@ static void
    w_float(double d, struct dump_arg *arg)
    {
  • char buf[100];
  • char buf[FLOAT_DIG + (DECIMAL_MANT + 7) / 8 + 10];

    if (isinf(d)) {
    @@ -327,5 +327,5 @@ w_float(double d, struct dump_arg *arg)

/* xxx: should not use system’s sprintf(3) */

  • sprintf(buf, “%.*g”, FLOAT_DIG, d);
  • snprintf(buf, sizeof(buf), “%.*g”, FLOAT_DIG, d);
    len = strlen(buf);
    w_bytes(buf, len + save_mantissa(d, buf + len), arg);
    Index: parse.y
    ===================================================================
    — parse.y (revision 13429)
    +++ parse.y (working copy)
    @@ -8554,19 +8554,15 @@ rb_id2str(ID id)
    if (is_attrset_id(id)) {
    ID id2 = (id & ~ID_SCOPE_MASK) | ID_LOCAL;
  • VALUE str;
  •  again:
    
  • name = rb_id2name(id2);
  • if (name) {
  •  char *buf = ALLOCA_N(char, strlen(name)+2);
    
  •  strcpy(buf, name);
    
  •  strcat(buf, "=");
    
  •  rb_intern(buf);
    
  •  return rb_id2str(id);
    
  • }
  • if (is_local_id(id2)) {
  • while (!(str = rb_id2str(id2))) {
  •  if (!is_local_id(id2)) return 0;
     id2 = (id & ~ID_SCOPE_MASK) | ID_CONST;
    
  •  goto again;
    
    }
  • str = rb_str_dup(str);
  • rb_str_cat(buf, “=”, 1);
  • rb_intern_str(str);
  • if (st_lookup(global_symbols.id_str, id, &data))
  •  return (VALUE)data;
    
    }
    return 0;

e$B$^$D$b$He(B e$B$f$-$R$m$G$9e(B

In message “Re: [ruby-dev:31776] Re: 1.9 on OpenBSD”
on Wed, 12 Sep 2007 11:18:22 +0900, Nobuyoshi N.
[email protected] writes:

|e$B$3$3$G$OI,MW$JD9$5$r3d$jEv$F$F$+$i%3%T!<$7$F$$$k$N$G!“e(Bstrcpye$B$G$be(B
|e$BLdBj$O$J$$$O$:$G$9!#$`$7$mLdBj$O$=$NA0$Ne(Ballocae$B$K$”$C$F!"MF0W$Ke(B
|stack overflowe$B$r5/$3$;$^$9!#e(B
|
| $ ruby19 -e ‘IO.sysopen(“x”*10_000_000)’
| e$B%;%0%a%s%F!<%7%g%s0cH?$G$9e(B (core dumped)

e$B$=$&$G$9$M!#D9$5$,$O$C$-$j$7$J$$$b$N$Oe(Ballocae$B$7$J$$J}$,NI$5$=e(B
e$B$&$G$9$M!#%3%_%C%H$7$F$/[email protected]$5$$!#e(B

|e$B$A$J$_$K!“e(Brb_str_cat()e$B$J$I$N0z?t$K$”$ke(Bchar*e$B$N%(%s%3!<%G%#%s%0$Oe(B
|e$B$I$&$J$k$s$G$7$g$&$+!#e(BASCII?

stre$B$HF1$8%(%s%3!<%G%#%s%0$rA[Dj$7$F$^$9!#e(B

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs