http://bugs.winehq.org/show_bug.cgi?id=17318
Summary: winemenubuilder fails to create proper menu structure Product: Wine Version: 1.1.14 Platform: PC-x86-64 OS/Version: Linux Status: NEW Keywords: source Severity: minor Priority: P2 Component: programs AssignedTo: wine-bugs@winehq.org ReportedBy: vitaliy@kievinfo.com CC: damjan.jov@gmail.com
After installing of any application winemenubuilder fails to create proper menu structure and puts all the links under "Application".
The bug is in write_menu_file() function: if (ret) ret = (rename(tempfilename, menuPath) == 0);
Raname does not work across file systems. And I have /tmp on a separate mount.
http://bugs.winehq.org/show_bug.cgi?id=17318
Damjan Jovanovic damjan.jov@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Difficulty|--- |Minutes
--- Comment #1 from Damjan Jovanovic damjan.jov@gmail.com 2009-02-08 22:57:19 --- The bug starts ealier in the write_menu_file() function, where tempfilename is generated:
tempfilename = tempnam(xdg_config_dir, "_wine");
You'll note that the directory is passed as xdg_config_dir, not /tmp. But the tempnam() function will first examine the environment variable $TMPDIR and use that, and only if that environment variable isn't set, try the passed directory.
I could unset $TMPDIR before and set it after calling tempnam() to force it to use xdg_config_dir.
http://bugs.winehq.org/show_bug.cgi?id=17318
Damjan Jovanovic damjan.jov@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- AssignedTo|wine-bugs@winehq.org |damjan.jov@gmail.com Status|NEW |ASSIGNED
--- Comment #2 from Damjan Jovanovic damjan.jov@gmail.com 2009-02-08 22:58:03 --- Created an attachment (id=19344) --> (http://bugs.winehq.org/attachment.cgi?id=19344) Unset and set the TMPDIR environment variable
Please try this patch.
http://bugs.winehq.org/show_bug.cgi?id=17318
--- Comment #3 from Vitaliy Margolen vitaliy@kievinfo.com 2009-03-03 15:15:27 --- Problem still exist in wine-1.1.16.
First I'd suggest using mkstemp() instead. Second, creating temp files in the data directory is not a good thing. Third even if the /tmp and /home are on the same file system there could be a menu file with the same name already in xdg_config_dir.
http://bugs.winehq.org/show_bug.cgi?id=17318
--- Comment #4 from Damjan Jovanovic damjan.jov@gmail.com 2009-03-04 09:13:17 --- 1. mkstemp() doesn't give you the filename, and there is no way to get the filename from the fd without fstat() + an exhaustive search of the entire filesystem. The filename is required to rename() the file later.
2 and 3. Creating the file in the data dir is necessary to ensure rename() works, since /tmp might be on a different filesystem. The loop with mkstemp() and the open() with O_EXCL should prevent all concurrency issues. And even if that directory is on NFS (causing open + O_EXCL to always pass), the semaphore held by winemenubuilder will prevent concurrent winemenubuilder invocations for the same wineserver from clobbering each other.
Does that patch I posted earlier work?
http://bugs.winehq.org/show_bug.cgi?id=17318
--- Comment #5 from Vitaliy Margolen vitaliy@kievinfo.com 2009-04-26 18:13:39 --- Still a problem with wine-1.1.20. Damjan, is there something you are waiting for? Any of your proposed patches fix the problem. Because the problem is straight forward and well understood.
Please send patch(es) to wine-patches to this bug can be closed.
http://bugs.winehq.org/show_bug.cgi?id=17318
Damjan Jovanovic damjan.jov@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |RESOLVED Resolution| |FIXED
--- Comment #6 from Damjan Jovanovic damjan.jov@gmail.com 2009-06-25 08:25:38 --- My 3rd attempt at a patch for this just went into Git, resolving fixed.
http://bugs.winehq.org/show_bug.cgi?id=17318
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #7 from Alexandre Julliard julliard@winehq.org 2009-07-03 12:23:18 --- Closing bugs fixed in 1.1.25.