# 1.9 on OpenBSD

**URL:** <https://www.ruby-forum.com/t/1-9-on-openbsd/114379>\
**Category:** Development\
**Created:** [September 12, 2007, 12:11am UTC](https://www.ruby-forum.com/t/1-9-on-openbsd/114379 "2007-09-12T00:11:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![SASADA\_Koichi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/f1d935/32.png) [@SASADA\_Koichi](https://www.ruby-forum.com/u/SASADA_Koichi)\
**Post date:** [September 12, 2007, 12:11am UTC](https://www.ruby-forum.com/t/1-9-on-openbsd/114379/1 "2007-09-12T00:11:37Z")

</div>

e$B!!$5$5$@$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 function`w\_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()

---

<div class="post-metadata">

**Author:** ![SASADA\_Koichi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/f1d935/32.png) [@SASADA\_Koichi](https://www.ruby-forum.com/u/SASADA_Koichi)\
**Post date:** [September 12, 2007, 4:18am UTC](https://www.ruby-forum.com/t/1-9-on-openbsd/114379/2 "2007-09-12T04:18:58Z")

</div>

e$B$J$+$@$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$$$&$@$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];

/\* 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;

---

<div class="post-metadata">

**Author:** ![SASADA\_Koichi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/f1d935/32.png) [@SASADA\_Koichi](https://www.ruby-forum.com/u/SASADA_Koichi)\
**Post date:** [September 12, 2007, 7:32am UTC](https://www.ruby-forum.com/t/1-9-on-openbsd/114379/3 "2007-09-12T07:32:11Z")

</div>

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.  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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$/$@$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
