Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 35821 - ebuilds fail ('open_wr' sandbox violation) if fopen "rt" used in build scripts (instead of plain fopen "r")
Summary: ebuilds fail ('open_wr' sandbox violation) if fopen "rt" used in build script...
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Sandbox (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords: InVCS
Depends on:
Blocks:
 
Reported: 2003-12-14 12:09 UTC by asko kauppi
Modified: 2005-04-28 00:26 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
patch to allow fopen("rt") in sandbox (portage-sandbox-fopen-rt.patch,2.06 KB, patch)
2004-06-30 09:18 UTC, Aron Griffis (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description asko kauppi 2003-12-14 12:09:27 UTC
It seems that the sandbox compares fopen param against "r" only, thinking that "rt" would write the file (which it of course doesn't). I got my build to proceed after changing "rt" to "r" for Linux but the better cure would be to fix portage. Especially since "rb"/"rt" is the preferred way for portable code.


Reproducible: Always
Steps to Reproduce:
1. Make a program that uses fopen("rt") outside of the portage sandbox (i.e. read in some system header)
2. Make that program a part of the build process.
3. Try to emerge the formed package.
4. Should fail in "open_wr" violation report.
Actual Results:  
"open_wr" violation report doing "emerge luax".
Don't have the log available (sorry!) and i already fixed the case by changing "rt"->"r".

Expected Results:  
succesful emerge


If you want, i can easily "unfix" my package so it produces this bug. However, i would need other 
help to bring in the package to Gentoo guidelines (i.e. locating of the various files etc.). If you can 
point a person to help me with that, i would be very grateful. A little handtaking, and we'll have yet 
another package for emerge. :)

-ak
Comment 1 Seemant Kulleen (RETIRED) gentoo-dev 2003-12-19 03:18:26 UTC
sandbox fix, Az?
Comment 2 Meder Bakirov 2004-01-21 21:32:35 UTC
I also got this messages:

----- ACCESS VIOLATION SUMMARY -----
LOG FILE = "/tmp/sandbox-gettext-0.12.1-652.log"

open_wr:    /proc/self/maps
open_wr:    /proc/self/maps
open_wr:    /proc/self/maps
open_wr:    /proc/self/maps
open_wr:    /proc/self/maps
open_wr:    /proc/self/maps
open_wr:    /proc/self/maps
open_wr:    /proc/self/maps
open_wr:    /proc/self/maps
open_wr:    /proc/self/maps
open_wr:    /proc/self/maps
open_wr:    /proc/self/maps
-------------------------------------------------------------------
Comment 3 SpanKY gentoo-dev 2004-01-21 21:41:14 UTC
meder: your bug is completely unrelated to this one ... please search bugzilla to find the real bug you're experiencing (hint it's a configuration problem on your side)
Comment 4 Aron Griffis (RETIRED) gentoo-dev 2004-06-30 09:17:52 UTC
I've looked through the standards (SUSv2, SUSv3, IEEE Std 1003.1-1996, IEEE Std 1003.2-1992) and there is no mention at all of "rt" being valid for fopen().  It appears that "rb" is an alternative to "r" for systems that support text-based and binary-based file access.  There is no such thing as "rt", so I believe that the package you're porting is written incorrectly.

Nonetheless, there are references on the web that suggest "rt", so maybe that's an extension implemented on DOS and/or Windows platforms.  Since it's read-only we can probably add this extra check to portage.  If it were "wt" then we would have a problem since the application would be expecting special support not available in glibc.

I'll attach the appropriate patch to the sandbox code and reassigned to dev-portage for application.  I have no idea which libsandbox.c is currently in use so I patched all of them.
Comment 5 Aron Griffis (RETIRED) gentoo-dev 2004-06-30 09:18:59 UTC
Created attachment 34495 [details, diff]
patch to allow fopen("rt") in sandbox
Comment 6 Seth Robertson 2004-07-24 18:32:28 UTC
See bug 58240 for a more general patch.  There are other undocumented modifiers which are in use (even in use by glibc), and even more annoyingly, they may be used in combinations and in different orders.
Comment 7 Jason Stubbs (RETIRED) gentoo-dev 2005-04-28 00:26:15 UTC
Is in portage-2.0.51.19.