Rockbox

  • Status Closed
  • Percent Complete
    100%
  • Task Type Bugs
  • Category User Interface → Simulator
  • Assigned To
    safetydan
  • Operating System All players
  • Severity Low
  • Priority Very Low
  • Reported Version
  • Due in Version Undecided
  • Due Date Undecided
  • Votes
  • Private
Attached to Project: Rockbox
Opened by Malcohol - 2006-05-28

FS#5452 - Some file creation operations fail in the simulators

Context:
I'm running the siulator in Debian GNU/Linux with a 2.6.16 kernel. I've
got simulators set up for several of the devices, and the bug exists in
all of them. I'm phyically running rockbox on an iAudio X5L (not that
that matters much for this bug report).

Example of problem:
Brickmania highscores, eq settings, etc are not being saved properly
in the simulator.

Description:
Files are being created in the wrong mode. Looking through the sources, I
see that the creat function (and correspondingly sim_creat in the
simulator) are usually called with the mode O_WRONLY. This works fine in
both simulator and on my X5.

However, at the places listed below the numeric constant 0 is used as the
mode. For the instances I've been able to try, they work on the X5, but
fail in the simulator.

apps/eq_menu.c: fd = creat(filename,0);
apps/plugins/battery_test.c: f = rb→creat("/battery.dummy", 0);
apps/plugins/calendar.c: fq = rb→creat("/.rockbox/~temp", 0);
apps/plugins/calendar.c: fp = rb→creat("/.rockbox/.memo", 0);
apps/plugins/configfile.c: fd = cfg_rb→creat(buf, 0);
apps/plugins/iriverify.c: fd = rb→creat(tmpfilename, 0);
apps/plugins/search.c: fdw = rb→creat(resultfile,0);
apps/plugins/sort.c: fd = rb→creat(tmpfilename, 0);
apps/settings.c: fd = creat(filename,0);
apps/tree.c: fd = creat(filename,0);
firmware/font.c: glyph_file = creat(GLYPH_CACHE_FILE, 0);

It seems likely that changing 0 to O_WRONLY in the above would fix the
problem in the short term. I won't submit a patch for this, as I don't yet
feel that I fully understanding the issues.

A little more exploring suggests that there's a weirdness about how the
simulator views file modes. In uisimulator/common/io.c, the function
rockbox2sim is clearly intended to converts a mode_t for a real device
into a mode_t for the simulator. The code shows that the simulator expects
1 to correspond to a WRONLY mode, not 0.

I can't find a place where these mode values are documented (which doesn't
mean there isn't one). However, if the logic of the modes really is
different between the versions, then perhaps Rockbox should define it's
own modes which get #defined one way for the simulators and another way
for the device. (Of course, this may already be what's happening, since
O_WRONLY works on both simulator and device.)

Closed by  safetydan
2006-05-30 11:32
Reason for closing:  Fixed
Additional comments about closing:   Warning: Undefined array key "typography" in /home/rockbox/flyspray/plugins/dokuwiki/inc/parserutils.php on line 371 Warning: Undefined array key "camelcase" in /home/rockbox/flyspray/plugins/dokuwiki/inc/parserutils.php on line 407

This should now be fixed in CVS builds.

0 is actually O_RDONLY so the rockbox2sim function is working correctly. It's all those creat() calls that are wrong.

Loading...

Available keyboard shortcuts

Tasklist

Task Details

Task Editing