public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xconfig: merge code path to conf_write()
@ 2011-05-24 18:16 Arnaud Lacombe
  2011-05-25 13:18 ` Michal Marek
  0 siblings, 1 reply; 5+ messages in thread
From: Arnaud Lacombe @ 2011-05-24 18:16 UTC (permalink / raw)
  To: linux-kbuild, linux-kernel; +Cc: Hiromu Yakura, Michal Marek, Arnaud Lacombe

Michal, Hiromu,

That should fix the first error miss in xconfig. I'll have a look tonight to
gconf.

 - Arnaud

---

From: Arnaud Lacombe <lacombar@gmail.com>
Subject: [PATCH] xconfig: merge code path to conf_write()

Avoid to have multiple path saving the config. This fixes an error check miss
when the window is being closed and the user requested the config to be written.

Reported-by: Hiromu Yakura <hiromu1996@gmail.com>
Pointed-out-by: Michal Marek <mmarek@suse.cz>
Signed-off-by: Arnaud Lacombe <lacombar@gmail.com>
---
 scripts/kconfig/qconf.cc |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc
index 06dd2e3..c2796b8 100644
--- a/scripts/kconfig/qconf.cc
+++ b/scripts/kconfig/qconf.cc
@@ -1489,8 +1489,7 @@ void ConfigMainWindow::saveConfigAs(void)
 	QString s = Q3FileDialog::getSaveFileName(conf_get_configname(), NULL, this);
 	if (s.isNull())
 		return;
-	if (conf_write(QFile::encodeName(s)))
-		QMessageBox::information(this, "qconf", _("Unable to save configuration!"));
+	saveConfig();
 }
 
 void ConfigMainWindow::searchConfig(void)
@@ -1643,7 +1642,7 @@ void ConfigMainWindow::closeEvent(QCloseEvent* e)
 	mb.setButtonText(QMessageBox::Cancel, _("Cancel Exit"));
 	switch (mb.exec()) {
 	case QMessageBox::Yes:
-		conf_write(NULL);
+		saveConfig();
 	case QMessageBox::No:
 		e->accept();
 		break;
-- 
1.7.3.4.574.g608b.dirty


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] xconfig: merge code path to conf_write()
  2011-05-24 18:16 [PATCH] xconfig: merge code path to conf_write() Arnaud Lacombe
@ 2011-05-25 13:18 ` Michal Marek
  2011-07-25 13:53   ` Michal Marek
  0 siblings, 1 reply; 5+ messages in thread
From: Michal Marek @ 2011-05-25 13:18 UTC (permalink / raw)
  To: Arnaud Lacombe; +Cc: linux-kbuild, linux-kernel, Hiromu Yakura

On Tue, May 24, 2011 at 02:16:18PM -0400, Arnaud Lacombe wrote:
> Avoid to have multiple path saving the config. This fixes an error check miss
> when the window is being closed and the user requested the config to be written.
> 
> Reported-by: Hiromu Yakura <hiromu1996@gmail.com>
> Pointed-out-by: Michal Marek <mmarek@suse.cz>
> Signed-off-by: Arnaud Lacombe <lacombar@gmail.com>
> ---
>  scripts/kconfig/qconf.cc |    5 ++---
>  1 files changed, 2 insertions(+), 3 deletions(-)

Applied, thanks.

The following patch avoids the data loss if the configuration cannot be
saved.

Michal

Subject: [PATCH] xconfig: Abort close if configuration cannot be saved

Give the user an opportunity to fix the error or save the configuration
under a different path.

Reported-by: Hiromu Yakura <hiromu1996@gmail.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>

diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc
index c2796b8..92bf576 100644
--- a/scripts/kconfig/qconf.cc
+++ b/scripts/kconfig/qconf.cc
@@ -1478,10 +1478,13 @@ void ConfigMainWindow::loadConfig(void)
 	ConfigView::updateListAll();
 }
 
-void ConfigMainWindow::saveConfig(void)
+bool ConfigMainWindow::saveConfig(void)
 {
-	if (conf_write(NULL))
+	if (conf_write(NULL)) {
 		QMessageBox::information(this, "qconf", _("Unable to save configuration!"));
+		return false;
+	}
+	return true;
 }
 
 void ConfigMainWindow::saveConfigAs(void)
@@ -1642,7 +1645,11 @@ void ConfigMainWindow::closeEvent(QCloseEvent* e)
 	mb.setButtonText(QMessageBox::Cancel, _("Cancel Exit"));
 	switch (mb.exec()) {
 	case QMessageBox::Yes:
-		saveConfig();
+		if (saveConfig())
+			e->accept();
+		else
+			e->ignore();
+		break;
 	case QMessageBox::No:
 		e->accept();
 		break;
diff --git a/scripts/kconfig/qconf.h b/scripts/kconfig/qconf.h
index 91677d9..3715b3e 100644
--- a/scripts/kconfig/qconf.h
+++ b/scripts/kconfig/qconf.h
@@ -311,7 +311,7 @@ public slots:
 	void listFocusChanged(void);
 	void goBack(void);
 	void loadConfig(void);
-	void saveConfig(void);
+	bool saveConfig(void);
 	void saveConfigAs(void);
 	void searchConfig(void);
 	void showSingleView(void);

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] xconfig: merge code path to conf_write()
  2011-05-25 13:18 ` Michal Marek
@ 2011-07-25 13:53   ` Michal Marek
  2011-07-25 15:25     ` Arnaud Lacombe
  0 siblings, 1 reply; 5+ messages in thread
From: Michal Marek @ 2011-07-25 13:53 UTC (permalink / raw)
  To: Arnaud Lacombe; +Cc: linux-kbuild, linux-kernel, Hiromu Yakura

On 25.5.2011 15:18, Michal Marek wrote:
> The following patch avoids the data loss if the configuration cannot be
> saved.
>
> Michal
>
> Subject: [PATCH] xconfig: Abort close if configuration cannot be saved
>
> Give the user an opportunity to fix the error or save the configuration
> under a different path.
>
> Reported-by: Hiromu Yakura<hiromu1996@gmail.com>
> Signed-off-by: Michal Marek<mmarek@suse.cz>

I completely forgot about this patch. It's applied now and will be in 3.1.

Michal
>
> diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc
> index c2796b8..92bf576 100644
> --- a/scripts/kconfig/qconf.cc
> +++ b/scripts/kconfig/qconf.cc
> @@ -1478,10 +1478,13 @@ void ConfigMainWindow::loadConfig(void)
>   	ConfigView::updateListAll();
>   }
>
> -void ConfigMainWindow::saveConfig(void)
> +bool ConfigMainWindow::saveConfig(void)
>   {
> -	if (conf_write(NULL))
> +	if (conf_write(NULL)) {
>   		QMessageBox::information(this, "qconf", _("Unable to save configuration!"));
> +		return false;
> +	}
> +	return true;
>   }
>
>   void ConfigMainWindow::saveConfigAs(void)
> @@ -1642,7 +1645,11 @@ void ConfigMainWindow::closeEvent(QCloseEvent* e)
>   	mb.setButtonText(QMessageBox::Cancel, _("Cancel Exit"));
>   	switch (mb.exec()) {
>   	case QMessageBox::Yes:
> -		saveConfig();
> +		if (saveConfig())
> +			e->accept();
> +		else
> +			e->ignore();
> +		break;
>   	case QMessageBox::No:
>   		e->accept();
>   		break;
> diff --git a/scripts/kconfig/qconf.h b/scripts/kconfig/qconf.h
> index 91677d9..3715b3e 100644
> --- a/scripts/kconfig/qconf.h
> +++ b/scripts/kconfig/qconf.h
> @@ -311,7 +311,7 @@ public slots:
>   	void listFocusChanged(void);
>   	void goBack(void);
>   	void loadConfig(void);
> -	void saveConfig(void);
> +	bool saveConfig(void);
>   	void saveConfigAs(void);
>   	void searchConfig(void);
>   	void showSingleView(void);
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] xconfig: merge code path to conf_write()
  2011-07-25 13:53   ` Michal Marek
@ 2011-07-25 15:25     ` Arnaud Lacombe
  2011-07-25 21:24       ` Michal Marek
  0 siblings, 1 reply; 5+ messages in thread
From: Arnaud Lacombe @ 2011-07-25 15:25 UTC (permalink / raw)
  To: Michal Marek; +Cc: linux-kbuild, linux-kernel, Hiromu Yakura

Hi Michal,

On Mon, Jul 25, 2011 at 9:53 AM, Michal Marek <mmarek@suse.cz> wrote:
> On 25.5.2011 15:18, Michal Marek wrote:
>>
>> The following patch avoids the data loss if the configuration cannot be
>> saved.
>>
>> Michal
>>
>> Subject: [PATCH] xconfig: Abort close if configuration cannot be saved
>>
>> Give the user an opportunity to fix the error or save the configuration
>> under a different path.
>>
>> Reported-by: Hiromu Yakura<hiromu1996@gmail.com>
>> Signed-off-by: Michal Marek<mmarek@suse.cz>
>
> I completely forgot about this patch. It's applied now and will be in 3.1.
>
gni ? isn't this issue already fixed by
https://patchwork.kernel.org/patch/812862/ which went in v3.0 ??

 - Arnaud

> Michal
>>
>> diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc
>> index c2796b8..92bf576 100644
>> --- a/scripts/kconfig/qconf.cc
>> +++ b/scripts/kconfig/qconf.cc
>> @@ -1478,10 +1478,13 @@ void ConfigMainWindow::loadConfig(void)
>>        ConfigView::updateListAll();
>>  }
>>
>> -void ConfigMainWindow::saveConfig(void)
>> +bool ConfigMainWindow::saveConfig(void)
>>  {
>> -       if (conf_write(NULL))
>> +       if (conf_write(NULL)) {
>>                QMessageBox::information(this, "qconf", _("Unable to save
>> configuration!"));
>> +               return false;
>> +       }
>> +       return true;
>>  }
>>
>>  void ConfigMainWindow::saveConfigAs(void)
>> @@ -1642,7 +1645,11 @@ void ConfigMainWindow::closeEvent(QCloseEvent* e)
>>        mb.setButtonText(QMessageBox::Cancel, _("Cancel Exit"));
>>        switch (mb.exec()) {
>>        case QMessageBox::Yes:
>> -               saveConfig();
>> +               if (saveConfig())
>> +                       e->accept();
>> +               else
>> +                       e->ignore();
>> +               break;
>>        case QMessageBox::No:
>>                e->accept();
>>                break;
>> diff --git a/scripts/kconfig/qconf.h b/scripts/kconfig/qconf.h
>> index 91677d9..3715b3e 100644
>> --- a/scripts/kconfig/qconf.h
>> +++ b/scripts/kconfig/qconf.h
>> @@ -311,7 +311,7 @@ public slots:
>>        void listFocusChanged(void);
>>        void goBack(void);
>>        void loadConfig(void);
>> -       void saveConfig(void);
>> +       bool saveConfig(void);
>>        void saveConfigAs(void);
>>        void searchConfig(void);
>>        void showSingleView(void);
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] xconfig: merge code path to conf_write()
  2011-07-25 15:25     ` Arnaud Lacombe
@ 2011-07-25 21:24       ` Michal Marek
  0 siblings, 0 replies; 5+ messages in thread
From: Michal Marek @ 2011-07-25 21:24 UTC (permalink / raw)
  To: Arnaud Lacombe; +Cc: linux-kbuild, linux-kernel, Hiromu Yakura

On 25.7.2011 17:25, Arnaud Lacombe wrote:
> Hi Michal,
> 
> On Mon, Jul 25, 2011 at 9:53 AM, Michal Marek <mmarek@suse.cz> wrote:
>> On 25.5.2011 15:18, Michal Marek wrote:
>>>
>>> The following patch avoids the data loss if the configuration cannot be
>>> saved.
>>>
>>> Michal
>>>
>>> Subject: [PATCH] xconfig: Abort close if configuration cannot be saved
>>>
>>> Give the user an opportunity to fix the error or save the configuration
>>> under a different path.
>>>
>>> Reported-by: Hiromu Yakura<hiromu1996@gmail.com>
>>> Signed-off-by: Michal Marek<mmarek@suse.cz>
>>
>> I completely forgot about this patch. It's applied now and will be in 3.1.
>>
> gni ? isn't this issue already fixed by
> https://patchwork.kernel.org/patch/812862/ which went in v3.0 ??

That's the prerequisite. This patch makes sure that xconfig does not
exit if the save failed.

Michal

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-07-25 21:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-24 18:16 [PATCH] xconfig: merge code path to conf_write() Arnaud Lacombe
2011-05-25 13:18 ` Michal Marek
2011-07-25 13:53   ` Michal Marek
2011-07-25 15:25     ` Arnaud Lacombe
2011-07-25 21:24       ` Michal Marek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox