Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Crash Utility (http://www.linux-archive.org/crash-utility/)
-   -   Support systems that do not have /boot as a separate filesystem (http://www.linux-archive.org/crash-utility/646931-support-systems-do-not-have-boot-separate-filesystem.html)

Cleber Rosa 03-20-2012 05:55 PM

Support systems that do not have /boot as a separate filesystem
 
While testing grubby on systems with a root (/) filesystem that includes
the /boot directory, it was noticed that grubby displayed the prefix (/boot)
twice.

This patch prevents printing the prefix twice on kernel and initrd lines.

Signed-off-by: Cleber Rosa <crosa@redhat.com>
---
grubby.c | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/grubby.c b/grubby.c
index 601ba8d..bf5fb37 100644
--- a/grubby.c
+++ b/grubby.c
@@ -1861,7 +1861,10 @@ void displayEntry(struct singleEntry * entry, const char * prefix, int index) {
return;
}

- printf("kernel=%s%s
", prefix, line->elements[1].item);
+ if (!strncmp(prefix, line->elements[1].item, strlen(prefix)))
+ printf("kernel=%s
", line->elements[1].item);
+ else
+ printf("kernel=%s%s
", prefix, line->elements[1].item);

if (line->numElements >= 3) {
printf("args="");
@@ -1920,7 +1923,11 @@ void displayEntry(struct singleEntry * entry, const char * prefix, int index) {
line = getLineByType(LT_INITRD, entry->lines);

if (line && line->numElements >= 2) {
- printf("initrd=%s", prefix);
+ if (!strncmp(prefix, line->elements[1].item, strlen(prefix)))
+ printf("initrd=");
+ else
+ printf("initrd=%s", prefix);
+
for (i = 1; i < line->numElements; i++)
printf("%s%s", line->elements[i].item, line->elements[i].indent);
printf("
");
--
1.7.6.5

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

Peter Jones 03-20-2012 07:18 PM

Support systems that do not have /boot as a separate filesystem
 
On 03/20/2012 02:55 PM, Cleber Rosa wrote:
> While testing grubby on systems with a root (/) filesystem that includes
> the /boot directory, it was noticed that grubby displayed the prefix (/boot)
> twice.
>
> This patch prevents printing the prefix twice on kernel and initrd lines.
>
> Signed-off-by: Cleber Rosa <crosa@redhat.com>

This needs a test case as well.

> ---
> grubby.c | 11 +++++++++--
> 1 files changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/grubby.c b/grubby.c
> index 601ba8d..bf5fb37 100644
> --- a/grubby.c
> +++ b/grubby.c
> @@ -1861,7 +1861,10 @@ void displayEntry(struct singleEntry * entry, const char * prefix, int index) {
> return;
> }
>
> - printf("kernel=%s%s
", prefix, line->elements[1].item);
> + if (!strncmp(prefix, line->elements[1].item, strlen(prefix)))
> + printf("kernel=%s
", line->elements[1].item);
> + else
> + printf("kernel=%s%s
", prefix, line->elements[1].item);
>
> if (line->numElements >= 3) {
> printf("args="");
> @@ -1920,7 +1923,11 @@ void displayEntry(struct singleEntry * entry, const char * prefix, int index) {
> line = getLineByType(LT_INITRD, entry->lines);
>
> if (line && line->numElements >= 2) {
> - printf("initrd=%s", prefix);
> + if (!strncmp(prefix, line->elements[1].item, strlen(prefix)))
> + printf("initrd=");
> + else
> + printf("initrd=%s", prefix);
> +
> for (i = 1; i < line->numElements; i++)
> printf("%s%s", line->elements[i].item, line->elements[i].indent);
> printf("
");


--
Peter

RFC 882 put the dots in .com.

01234567890123456789012345678901234567890123456789 012345678901234567890123456789

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

Cleber Rosa 03-21-2012 05:18 PM

Support systems that do not have /boot as a separate filesystem
 
On 03/20/2012 05:18 PM, Peter Jones wrote:

On 03/20/2012 02:55 PM, Cleber Rosa wrote:

While testing grubby on systems with a root (/) filesystem that includes
the /boot directory, it was noticed that grubby displayed the prefix (/boot)
twice.

This patch prevents printing the prefix twice on kernel and initrd lines.

Signed-off-by: Cleber Rosa<crosa@redhat.com>

This needs a test case as well.


Actually, test/grub.12 is a file that captures the configuration of such
a system. Without this patch, the "GRUB lba and root information on SuSE
systems" test fails (showing /boot twice), so I considered this patch
was already covered by a test.


If you think we need another, more explicit and separate test, please
let me know.


Thanks!
CR.




---
grubby.c | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/grubby.c b/grubby.c
index 601ba8d..bf5fb37 100644
--- a/grubby.c
+++ b/grubby.c
@@ -1861,7 +1861,10 @@ void displayEntry(struct singleEntry * entry, const char * prefix, int index) {
return;
}

- printf("kernel=%s%s
", prefix, line->elements[1].item);
+ if (!strncmp(prefix, line->elements[1].item, strlen(prefix)))
+ printf("kernel=%s
", line->elements[1].item);
+ else
+ printf("kernel=%s%s
", prefix, line->elements[1].item);

if (line->numElements>= 3) {
printf("args="");
@@ -1920,7 +1923,11 @@ void displayEntry(struct singleEntry * entry, const char * prefix, int index) {
line = getLineByType(LT_INITRD, entry->lines);

if (line&& line->numElements>= 2) {
- printf("initrd=%s", prefix);
+ if (!strncmp(prefix, line->elements[1].item, strlen(prefix)))
+ printf("initrd=");
+ else
+ printf("initrd=%s", prefix);
+
for (i = 1; i< line->numElements; i++)
printf("%s%s", line->elements[i].item, line->elements[i].indent);
printf("
");




_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

Peter Jones 03-22-2012 01:24 PM

Support systems that do not have /boot as a separate filesystem
 
On 03/21/2012 02:18 PM, Cleber Rosa wrote:
> On 03/20/2012 05:18 PM, Peter Jones wrote:
>> On 03/20/2012 02:55 PM, Cleber Rosa wrote:
>>> While testing grubby on systems with a root (/) filesystem that includes
>>> the /boot directory, it was noticed that grubby displayed the prefix (/boot)
>>> twice.
>>>
>>> This patch prevents printing the prefix twice on kernel and initrd lines.
>>>
>>> Signed-off-by: Cleber Rosa<crosa@redhat.com>
>> This needs a test case as well.
>
> Actually, test/grub.12 is a file that captures the configuration of
> such a system. Without this patch, the "GRUB lba and root information
> on SuSE systems" test fails (showing /boot twice), so I considered
> this patch was already covered by a test.
>
> If you think we need another, more explicit and separate test, please
> let me know.

Huh? There are no currently checked-in tests that fail. If you're seeing
a failure, then it's being caused by some environmental condition. In that
case, it needs to be fixed so that it behaves the same on both environments,
but that probably also still does reflect a test suite problem that needs to
be independently addressed.

>
> Thanks!
> CR.
>
>>
>>> ---
>>> grubby.c | 11 +++++++++--
>>> 1 files changed, 9 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/grubby.c b/grubby.c
>>> index 601ba8d..bf5fb37 100644
>>> --- a/grubby.c
>>> +++ b/grubby.c
>>> @@ -1861,7 +1861,10 @@ void displayEntry(struct singleEntry * entry, const char * prefix, int index) {
>>> return;
>>> }
>>>
>>> - printf("kernel=%s%s
", prefix, line->elements[1].item);
>>> + if (!strncmp(prefix, line->elements[1].item, strlen(prefix)))
>>> + printf("kernel=%s
", line->elements[1].item);
>>> + else
>>> + printf("kernel=%s%s
", prefix, line->elements[1].item);
>>>
>>> if (line->numElements>= 3) {
>>> printf("args="");
>>> @@ -1920,7 +1923,11 @@ void displayEntry(struct singleEntry * entry, const char * prefix, int index) {
>>> line = getLineByType(LT_INITRD, entry->lines);
>>>
>>> if (line&& line->numElements>= 2) {
>>> - printf("initrd=%s", prefix);
>>> + if (!strncmp(prefix, line->elements[1].item, strlen(prefix)))
>>> + printf("initrd=");
>>> + else
>>> + printf("initrd=%s", prefix);
>>> +
>>> for (i = 1; i< line->numElements; i++)
>>> printf("%s%s", line->elements[i].item, line->elements[i].indent);
>>> printf("
");
>>
>


--
Peter

THE MAGIC WORDS ARE SQUEAMISH OSSIFRAGE

01234567890123456789012345678901234567890123456789 012345678901234567890123456789

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

Cleber Rosa 03-22-2012 03:44 PM

Support systems that do not have /boot as a separate filesystem
 
On 03/22/2012 11:24 AM, Peter Jones wrote:

On 03/21/2012 02:18 PM, Cleber Rosa wrote:

On 03/20/2012 05:18 PM, Peter Jones wrote:

On 03/20/2012 02:55 PM, Cleber Rosa wrote:

While testing grubby on systems with a root (/) filesystem that includes
the /boot directory, it was noticed that grubby displayed the prefix (/boot)
twice.

This patch prevents printing the prefix twice on kernel and initrd lines.

Signed-off-by: Cleber Rosa<crosa@redhat.com>

This needs a test case as well.

Actually, test/grub.12 is a file that captures the configuration of
such a system. Without this patch, the "GRUB lba and root information
on SuSE systems" test fails (showing /boot twice), so I considered
this patch was already covered by a test.

If you think we need another, more explicit and separate test, please
let me know.

Huh? There are no currently checked-in tests that fail. If you're seeing
a failure, then it's being caused by some environmental condition. In that
case, it needs to be fixed so that it behaves the same on both environments,
but that probably also still does reflect a test suite problem that needs to
be independently addressed.


Indeed there were no failures *before* this patch series, because there
was no configuration file with a kernel or initrd line that includes
/boot being tested like that.


So, to make it more clear: patch [01/10] fixes a problem with a
configuration file (test/grub.12) included in patch [03/10]. This
happened to be found while testing the feature provided by patch
[02/10], but does not depend on it. I moved the fix to the top of the
patch series, so that the test on patch [03/10] does not fail.





Thanks!
CR.


---
grubby.c | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/grubby.c b/grubby.c
index 601ba8d..bf5fb37 100644
--- a/grubby.c
+++ b/grubby.c
@@ -1861,7 +1861,10 @@ void displayEntry(struct singleEntry * entry, const char * prefix, int index) {
return;
}

- printf("kernel=%s%s
", prefix, line->elements[1].item);
+ if (!strncmp(prefix, line->elements[1].item, strlen(prefix)))
+ printf("kernel=%s
", line->elements[1].item);
+ else
+ printf("kernel=%s%s
", prefix, line->elements[1].item);

if (line->numElements>= 3) {
printf("args="");
@@ -1920,7 +1923,11 @@ void displayEntry(struct singleEntry * entry, const char * prefix, int index) {
line = getLineByType(LT_INITRD, entry->lines);

if (line&& line->numElements>= 2) {
- printf("initrd=%s", prefix);
+ if (!strncmp(prefix, line->elements[1].item, strlen(prefix)))
+ printf("initrd=");
+ else
+ printf("initrd=%s", prefix);
+
for (i = 1; i< line->numElements; i++)
printf("%s%s", line->elements[i].item, line->elements[i].indent);
printf("
");




_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

Cleber Rosa 03-27-2012 12:13 PM

Support systems that do not have /boot as a separate filesystem
 
While testing grubby on systems with a root (/) filesystem that includes
the /boot directory, it was noticed that grubby displayed the prefix (/boot)
twice. This patch prevents printing the prefix twice on kernel and initrd
lines.

This situation was found while testing the patch "Fix for grub on SuSE
systems: lba and boot information", so this fix is also covered by the
the test on patch "Fix for grub on SuSE systems: test lba and boot info".

Signed-off-by: Cleber Rosa <crosa@redhat.com>
---
grubby.c | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/grubby.c b/grubby.c
index f9f2129..c23bdf2 100644
--- a/grubby.c
+++ b/grubby.c
@@ -1964,7 +1964,10 @@ void displayEntry(struct singleEntry * entry, const char * prefix, int index) {
return;
}

- printf("kernel=%s%s
", prefix, line->elements[1].item);
+ if (!strncmp(prefix, line->elements[1].item, strlen(prefix)))
+ printf("kernel=%s
", line->elements[1].item);
+ else
+ printf("kernel=%s%s
", prefix, line->elements[1].item);

if (line->numElements >= 3) {
printf("args="");
@@ -2023,7 +2026,11 @@ void displayEntry(struct singleEntry * entry, const char * prefix, int index) {
line = getLineByType(LT_INITRD, entry->lines);

if (line && line->numElements >= 2) {
- printf("initrd=%s", prefix);
+ if (!strncmp(prefix, line->elements[1].item, strlen(prefix)))
+ printf("initrd=");
+ else
+ printf("initrd=%s", prefix);
+
for (i = 1; i < line->numElements; i++)
printf("%s%s", line->elements[i].item, line->elements[i].indent);
printf("
");
--
1.7.6.5

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


All times are GMT. The time now is 07:39 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.