Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 402139 - app-portage/conf-update-1.0.1 segfaults after doing a merge with multiple pending config files
Summary: app-portage/conf-update-1.0.1 segfaults after doing a merge with multiple pen...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal critical
Assignee: Chema Alonso Josa (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-02-04 10:08 UTC by Chema Alonso Josa (RETIRED)
Modified: 2012-02-17 21:44 UTC (History)
2 users (show)

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


Attachments
Patch fixing leaks reported by valgrind (conf-update-1.0.1-1.0.2-fix-leaks.patch,3.13 KB, patch)
2012-02-04 12:22 UTC, Vincent Huisman
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chema Alonso Josa (RETIRED) gentoo-dev 2012-02-04 10:08:30 UTC
The program segfaults when doing an update, usually when update more than 10 files.

Reproducible: Always

Steps to Reproduce:
1. Execute the following snippet: for i in /etc/{,conf.d/,init.d/}; do for j in 1 2 3 4 5 6; do echo a > ${i}dgtest${j}; echo b > ${i}._cfg0000_dgtest${j}; done; done
2. Run conf-update
3. Select some files for updating
4. Hit [R]eplace
Actual Results:  
Segmentation Fault

Expected Results:  
The config files should have been replaced with updates

Thanks to Vincent Huisman for reporting.
Comment 1 Vincent Huisman 2012-02-04 12:22:12 UTC
Created attachment 300907 [details, diff]
Patch fixing leaks reported by valgrind
Comment 2 Vincent Huisman 2012-02-04 12:28:18 UTC
Every time I got the segfault, gdb reported SEGV in strdup, malloc and such functions, so I ran it through valgrind to figure out where things were going wrong. Turns out the main culprit was the order in which remove_menu freed the menu and corresponding items, which caused writes to free'd memory and caused problems with large enough menus. The above patch should fix that. I also fixed the remaining leaks I could find with the limited test case outlined in the report.

The patch is 'verbose', the commented lines added in helpers.c chunk @@ -135,7 +139,7 @@ and in @@ -352,9 +363,9 @@ may be removed, I left them there purely to illustrate why the change was made.
Comment 3 Sebastian Pipping gentoo-dev 2012-02-17 21:44:46 UTC
+*conf-update-1.0.2 (17 Feb 2012)
+
+  17 Feb 2012; Sebastian Pipping <sping@gentoo.org> +conf-update-1.0.2.ebuild:
+  Fixes segfault (bug #402139, patch by Vincent Huisman), misc ebuild
+  improvements by Chema Alonso (nimiux)
+

Closing...