Skip to contentSkip to conversation

fix undesirable side effect of adding "visible" menu attribute

PATCH In review Jan Beulich 3 participants 12 messages Dec 9, 2010 – Dec 29, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix undesirable side effect of adding "visible" menu attribute

This lead to non-selected, non-user-selectable options to be written out to .config. This is not only pointless, but also preventing the user to be prompted should any of those options eventually become visible (e.g. by de-selecting the *_AUTO options the "visible" attribute was added for.

Furthermore it is quite logical for the "visible" attribute of a menu to control the visibility of all contained prompts, which is what the patch does.

---
 scripts/kconfig/menu.c |   14 ++++++++++++++
 1 file changed, 14 insertions(+)
scripts/kconfig/menu.c +14 -0
@@ -140,6 +140,20 @@ struct property *menu_add_prop(enum prop
 		}
 		if (current_entry->prompt && current_entry != &rootmenu)
 			prop_warn(prop, "prompt redefined");
+
+		/* Apply all upper menus' visibilities to actual prompts. */
+		if(type == P_PROMPT) {
+			struct menu *menu = current_entry;
+
+			while ((menu = menu->parent) != NULL) {
+				if (!menu->visibility)
+					continue;
+				prop->visible.expr
+					= expr_alloc_and(prop->visible.expr,
+							 menu->visibility);
+			}
+		}
+
 		current_entry->prompt = prop;
 	}
 	prop->text = prompt;
#1 lore raw

Hi,

Quoted 26 lines · Jan Beulich

This lead to non-selected, non-user-selectable options to be written out to .config. This is not only pointless, but also preventing the user to be prompted should any of those options eventually become visible (e.g. by de-selecting the *_AUTO options the "visible" attribute was added for.

Furthermore it is quite logical for the "visible" attribute of a menu to control the visibility of all contained prompts, which is what the patch does.

---
 scripts/kconfig/menu.c |   14 ++++++++++++++

 1 file changed, 14 insertions(+)
scripts/kconfig/menu.c +4 -0
@@ -140,6 +140,20 @@ struct property *menu_add_prop(enum prop
                }
                if (current_entry->prompt && current_entry != &rootmenu)
                        prop_warn(prop, "prompt redefined");
+
+               /* Apply all upper menus' visibilities to actual prompts. */
+               if(type == P_PROMPT) {
+                       struct menu *menu = current_entry;

scripts/kconfig/menu.c struct property *menu_add_prop(enum prop · line 156

Quoted 10 lines
scripts/kconfig/menu.c +10 -0
+
+                       while ((menu = menu->parent) != NULL) {
+                               if (!menu->visibility)
+                                       continue;
+                               prop->visible.expr
+                                       = expr_alloc_and(prop->visible.expr,
+                                                        menu->visibility);
+                       }
+               }
+

Shouldn't this better to be done in menu_finalize() ?

I'm not either a big fan of testing `menu->visibility' truth, it is an expression which should be expended by the proper expr_* accessor to have less things to fix later.

- Arnaud

Quoted 7 lines
scripts/kconfig/menu.c +0 -0
                current_entry->prompt = prop;
        }
        prop->text = prompt;
#2 lore raw

Hi,

On Thu, Dec 9, 2010 at 10:58 AM, Arnaud Lacombe <[email protected]> wrote:
[..]

Quoted 4 lines

I'm not either a big fan of testing `menu->visibility' truth, it is an expression which should be expended by the proper expr_* accessor to have less things to fix later.

gniarf, forget about that paragraph, I'm not fully awaken :/

What I thought about was the case where the visible property would explicitly default to 'y' in which case the expression will have to be simplified/manipulated, in that case, menu_finalize() will be the place to do that, so this come back to my first comment.

- Arnaud

#3 lore raw
Quoted 7 lines
Quoted 1 line
Quoted 1 line · Arnaud Lacombe

On Thu, Dec 9, 2010 at 10:58 AM, Arnaud Lacombe <[email protected]> wrote:
[..]

Quoted 4 lines

I'm not either a big fan of testing `menu->visibility' truth, it is an expression which should be expended by the proper expr_* accessor to have less things to fix later.

Quoted 6 lines

gniarf, forget about that paragraph, I'm not fully awaken :/

What I thought about was the case where the visible property would explicitly default to 'y' in which case the expression will have to be simplified/manipulated, in that case, menu_finalize() will be the place to do that, so this come back to my first comment.

I'm not sure in menu_finalize() you can properly/easily deal with multiple prompts associated with the same symbol under different menus.

Anyway, the patch I proposed works (for me), and I'm hoping to get it in unless someone (you?) comes up with a better one. Not fixing the (presumably unintended) side effect of your earlier patch seems undesirable to me.

Jan

#4 lore raw
In reply to Arnaud Lacombe
Quoted 15 lines
Quoted 1 line
Quoted 1 line · Arnaud Lacombe
Quoted 13 lines · Jan Beulich
scripts/kconfig/menu.c +7 -0
@@ -140,6 +140,20 @@ struct property *menu_add_prop(enum prop
               }
               if (current_entry->prompt && current_entry != &rootmenu)
                       prop_warn(prop, "prompt redefined");
+
+               /* Apply all upper menus' visibilities to actual prompts. */
+               if(type == P_PROMPT) {
+                       struct menu *menu = current_entry;
+
+                       while ((menu = menu->parent) != NULL) {
+                               if (!menu->visibility)
Quoted 8 lines

scripts/kconfig/menu.c struct property *menu_add_prop(enum prop · line 156

Quoted 7 lines
scripts/kconfig/menu.c +7 -0
+                                       continue;
+                               prop->visible.expr
+                                       = expr_alloc_and(prop->visible.expr,
+                                                        menu->visibility);
+                       }
+               }
+

Shouldn't this better to be done in menu_finalize() ?

I don't know, I just looked for a place where I could get it done in a reasonably simple way.

Quoted 3 lines

I'm not either a big fan of testing `menu->visibility' truth, it is an expression which should be expended by the proper expr_* accessor to have less things to fix later.

Not sure what you're telling me here? What accessor?

Jan

Acked-by on v1 1/1
#5 lore raw
In reply to Jan Beulich
Quoted 11 lines · Jan Beulich

This lead to non-selected, non-user-selectable options to be written out to .config. This is not only pointless, but also preventing the user to be prompted should any of those options eventually become visible (e.g. by de-selecting the *_AUTO options the "visible" attribute was added for.

Furthermore it is quite logical for the "visible" attribute of a menu to control the visibility of all contained prompts, which is what the patch does.

It also fixes the issue that all{mod,yes}config set some options from the invisible menus that cannot be selected interactively (e.g. I2C_ALGOPCF, that is only selected by I2C_ELEKTOR on !SMP), so this patch is

unless Arnaud has a good reason not to take it.

Michal

#6 lore raw

Hi,

Quoted 13 lines · Michal Marek
Quoted 11 lines · Jan Beulich

This lead to non-selected, non-user-selectable options to be written out to .config. This is not only pointless, but also preventing the user to be prompted should any of those options eventually become visible (e.g. by de-selecting the *_AUTO options the "visible" attribute was added for.

Furthermore it is quite logical for the "visible" attribute of a menu to control the visibility of all contained prompts, which is what the patch does.

Quoted 9 lines

It also fixes the issue that all{mod,yes}config set some options from the invisible menus that cannot be selected interactively (e.g. I2C_ALGOPCF, that is only selected by I2C_ELEKTOR on !SMP), so this patch is

unless Arnaud has a good reason not to take it.

Actually, I wanted to keep the parsing and tree construction as simple as possible. Fix-up like that should really happen in menu_finalize() as we will anyway traverse all the menus once again there and it is already doing all kind of dependency simplification, so that would keep everything at the same place.

Say that if I do not show up with a version which would move this in menu_finalize() by the end of the week (sooner if you want that for .37), feel free to forget about this mail. Hopefully, I'll not move back to Linux this week-end, so I should have the time to do that.

- Arnaud

#7 lore raw

Hi all,

Quoted 23 lines · Arnaud Lacombe

Hi,

Quoted 20 lines · Michal Marek
Quoted 11 lines · Jan Beulich

This lead to non-selected, non-user-selectable options to be written out to .config. This is not only pointless, but also preventing the user to be prompted should any of those options eventually become visible (e.g. by de-selecting the *_AUTO options the "visible" attribute was added for.

Furthermore it is quite logical for the "visible" attribute of a menu to control the visibility of all contained prompts, which is what the patch does.

It also fixes the issue that all{mod,yes}config set some options from the invisible menus that cannot be selected interactively (e.g. I2C_ALGOPCF, that is only selected by I2C_ELEKTOR on !SMP), so this patch is

Quoted 8 lines
Quoted 2 lines

unless Arnaud has a good reason not to take it.

Actually, I wanted to keep the parsing and tree construction as simple as possible. Fix-up like that should really happen in menu_finalize() as we will anyway traverse all the menus once again there and it is already doing all kind of dependency simplification, so that would keep everything at the same place.

hum, I just thought of something. Instead of adding more complexity to the menu children, why would {,m,n,q}conf descend to these submenus at first. they should just ignore all the childs if the parent is not meant to be visible and go to the next node on the same level. When I close the front door of my house, I do expect people to stop right there, not continue to check any door I may have left open inside.

- Arnaud

#8 lore raw
Quoted 7 lines
Quoted 1 line
Quoted 1 line · Arnaud Lacombe

hum, I just thought of something. Instead of adding more complexity to the menu children, why would {,m,n,q}conf descend to these submenus at first. they should just ignore all the childs if the parent is not meant to be visible and go to the next node on the same level. When I close the front door of my house, I do expect people to stop right there, not continue to check any door I may have left open inside.

Isn't that what's happening? I don't think the problem is with the frontends - it's the backend that writes out settings of options it didn't before (and shouldn't).

Jan

#9 lore raw
In reply to Arnaud Lacombe
Quoted 31 lines · Arnaud Lacombe

Hi,

Quoted 13 lines · Michal Marek
Quoted 11 lines · Jan Beulich

This lead to non-selected, non-user-selectable options to be written out to .config. This is not only pointless, but also preventing the user to be prompted should any of those options eventually become visible (e.g. by de-selecting the *_AUTO options the "visible" attribute was added for.

Furthermore it is quite logical for the "visible" attribute of a menu to control the visibility of all contained prompts, which is what the patch does.

Quoted 9 lines

It also fixes the issue that all{mod,yes}config set some options from the invisible menus that cannot be selected interactively (e.g. I2C_ALGOPCF, that is only selected by I2C_ELEKTOR on !SMP), so this patch is

unless Arnaud has a good reason not to take it.

Actually, I wanted to keep the parsing and tree construction as simple as possible. Fix-up like that should really happen in menu_finalize() as we will anyway traverse all the menus once again there and it is already doing all kind of dependency simplification, so that would keep everything at the same place.

Quoted 4 lines

Say that if I do not show up with a version which would move this in menu_finalize() by the end of the week (sooner if you want that for .37), feel free to forget about this mail. Hopefully, I'll not move back to Linux this week-end, so I should have the time to do that.

I'd like to have _some_ fix in 2.6.37, if Linus takes it. So unless you come up with an alternate patch RSN, I'll apply Jan's patch and send a pull request to Linus.

Michal

#10 lore raw

Hi,

Quoted 4 lines · Michal Marek

I'd like to have _some_ fix in 2.6.37, if Linus takes it. So unless you come up with an alternate patch RSN, I'll apply Jan's patch and send a pull request to Linus.

Please go on, the other solutions I had is more intrusive, and still need to be completed.

- Arnaud

#11 lore raw
Quoted 9 lines · Arnaud Lacombe

Hi,

Quoted 4 lines · Michal Marek

I'd like to have _some_ fix in 2.6.37, if Linus takes it. So unless you come up with an alternate patch RSN, I'll apply Jan's patch and send a pull request to Linus.

Please go on, the other solutions I had is more intrusive, and still need to be completed.

OK, applied Jan's patch to kbuild-2.6.git#rc-fixes.

Michal