Re: test -e patch

2007-06-05 Thread adrian15

adrian15 <[EMAIL PROTECTED]> writes:


> Attached you will find the patch adding test -e support for grub2.
>
> This is my first patch. I have compiled it without no errors.


Urgh... I thought/hoped I told you I had a test.c rewrite sitting on
my harddisk?  Or did I tell Robert to poke me until next weekend so I
will work on it?  It includes everything you expect from test.c,
expect the cleanup and testing.  ;-) 


Do you mean you also have the '-e' option ?



Please have a look at the wiki.  It has quite some information about
GRUB 2.

Whenever possible I'll download some info from the wiki.


> Should I write "Test if a file exists" instead of "test if a file
> exists" or "FILE exists"?


FILE


FILE
or
FILE exists ?

Or have you coded it yourself too?


> How the hell should I treat grub errors. Maybe the test_file_exists has
> to return a static grub_err_t and then from grub_cmd_test I should call
> it like this: return (test_file_exists (args[0])) so that the error
> propagates ?


Right.  Otherwise the error will be lost.


Ok. I will try that every function propagates errors.




> What are the error polices ?


Returning the err_t that grub_error returns when possible.

Ok.

> One question. Should we put the test-e function into a separate file or
> not ?


No, the problem is that the design of test.c (which is just a
placeholder) is wrong.  It needs a proper parser for the arguments and
a way to deal with this...


Ok. We will wait for your code.


> The question is if the user will see the -e, -f or other options when
> querying the test command help or not ?


They should.  But I am not sure if the final version will support
this.  Especially because of the nested syntax of the test arguments.


Do you mean the -e options support
or
do you mean the -e options showing at help test support ?


> +static void
> +test_file_exists (const char *key)


Why not filename?


test_filename_exists
or
filename

?


>  {
> +


You accidently introduced a whiteline.


No whitelines after an initial {. I write down it.


> +  if (state[0].set)
> +test_file_exists (args[0]);
> +  else
> +  {


This means that this check is run for any other expression.  This is
quite error sensitive.


In my code the only implemented option is '-e'. When there will be more
I could add more nested if with the other options, or maybe better we
will enjoy your improved code.


adrian15



___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


Re: gcs doubt #1

2007-06-05 Thread adrian15

> Please put a comment on each function saying what the function does,
> what sorts of arguments it gets, and what the possible values of
> arguments mean and are used for.
>
> Is it ok that the search.c and test.c (commands/ folder) do not have any
> of these comments at all?


The currect test.c is a dummy so the `if' expression can be
used/tested.

If you can provide a patch for sourcecode to improve or add comments
in a sane way, I am willing to commit those patches.  Just please
don't make the mistake to add useless comments.


An useful comment is one that:
-Describes a function algorithm
-Describes what a function does (as a black box)
-Boot of them ?

adrian15



___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


Re: GSoC: CD-ROM booting options

2007-06-05 Thread adrian15

Do we want to be able to boot the computer from GRUB2 installed on a
medium (whatever it may be), then be able to boot from a CD  (in
whatever mode - emulation or no emulation)?

Do we also want to be able to boot the computer through the BIOS from
a CD on which GRUB2 was installed and continue booting from the CD
(like GRUB legacy does)?

Do we want to support both?

Personally, I think both are important to support, but I want to see
what the majority of developers and users think we should support.


Although a lot of people want you to begin with the second option and
although it's a good thing for an hipothetical super grub2 disk... I
want to remind you what's the okuji thought about this:

===

My name is Alex Roman and I have been selected as a Summer of Code
> > student for the GRUB2 project. I will be adding CD-ROM booting
> > functionality to GRUB2.

>
> Welcome! Cdrom booting funcionality for grub2 is a good piece of news.
>

> > The first stage of the project will attempt to use BIOS calls
> > to achieve this functionality (which is, of course, dependent on the
> > BIOS's capabilities, standards compliance, etc.).

>
> Ok. That's how it works in Grub legacy I suppose.


Nope. This is a different thing. This is a new feature which is not
present in GRUB Legacy.

Although people often mistake this, booting a CD from GRUB is quite
different from booting a GRUB installed into a CD. GRUB Legacy has the
latter feature, but not the former one.

GRUB 2 needs to support both cases, but I prefer to see something not
present in GRUB Legacy implemented in GRUB 2 first.

===

But do as you want, maybe it is better to begin with the easiest task
and then doing the more difficult task.

adrian15



___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


Re: gcs doubt #1

2007-06-05 Thread Marco Gerards
adrian15 <[EMAIL PROTECTED]> writes:

>>> > Please put a comment on each function saying what the function does,
>>> > what sorts of arguments it gets, and what the possible values of
>>> > arguments mean and are used for.
>>> >
>>> > Is it ok that the search.c and test.c (commands/ folder) do not have any
>>> > of these comments at all?
>>
>> The currect test.c is a dummy so the `if' expression can be
>> used/tested.
>>
>> If you can provide a patch for sourcecode to improve or add comments
>> in a sane way, I am willing to commit those patches.  Just please
>> don't make the mistake to add useless comments.
>
> An useful comment is one that:
>   -Describes a function algorithm
>   -Describes what a function does (as a black box)
>   -Boot of them ?

Yes, but I oppose to adding obvious comments.  But patches will be
reviewed, so you will learn fast enough what we want :-).

--
Marco




___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


Re: test -e patch

2007-06-05 Thread Marco Gerards
adrian15 <[EMAIL PROTECTED]> writes:

>> adrian15 <[EMAIL PROTECTED]> writes:
>>
>>> > Attached you will find the patch adding test -e support for grub2.
>>> >
>>> > This is my first patch. I have compiled it without no errors.
>>
>> Urgh... I thought/hoped I told you I had a test.c rewrite sitting on
>> my harddisk?  Or did I tell Robert to poke me until next weekend so I
>> will work on it?  It includes everything you expect from test.c,
>> expect the cleanup and testing.  ;-)
>
> Do you mean you also have the '-e' option ?

I mean I have everything that is possible.  That includes `-e', but
also all other features.

Something noone looked at is "expr".

>> Please have a look at the wiki.  It has quite some information about
>> GRUB 2.
> Whenever possible I'll download some info from the wiki.
>
>>> > Should I write "Test if a file exists" instead of "test if a file
>>> > exists" or "FILE exists"?
>>
>> FILE
>
> FILE
> or
> FILE exists ?

FILE exists

> Or have you coded it yourself too?

Hm?

[...]

>> No, the problem is that the design of test.c (which is just a
>> placeholder) is wrong.  It needs a proper parser for the arguments and
>> a way to deal with this...
>
> Ok. We will wait for your code.

:-)

Sorry for the confusion :-/

>>> > The question is if the user will see the -e, -f or other options when
>>> > querying the test command help or not ?
>>
>> They should.  But I am not sure if the final version will support
>> this.  Especially because of the nested syntax of the test arguments.
>
> Do you mean the -e options support
> or
> do you mean the -e options showing at help test support ?

Well, the version for GNU/Linux doesn't show help text.  Perhaps it
cannot be implemented using the argument parser in a clean way.  I do
not remember.

>>> > +static void
>>> > +test_file_exists (const char *key)
>>
>> Why not filename?
>
> test_filename_exists
> or
> filename

I mean instead of key.

> ?
>
>>> >  {
>>> > +
>>
>> You accidently introduced a whiteline.
>
> No whitelines after an initial {. I write down it.

Well, usually adding whitespaces around code you didn't change is
wrong or dirty.

>>> > +  if (state[0].set)
>>> > +test_file_exists (args[0]);
>>> > +  else
>>> > +  {
>>
>> This means that this check is run for any other expression.  This is
>> quite error sensitive.
>
> In my code the only implemented option is '-e'. When there will be more
> I could add more nested if with the other options, or maybe better we
> will enjoy your improved code.

Sure.  Just poke me a lot during the weekend on IRC ;-)

--
Marco



___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


Re: grub2 miscelanea questions (1/2)

2007-06-05 Thread Marco Gerards
adrian15 <[EMAIL PROTECTED]> writes:

>   
>   Dear grub2 developers, here there are some questions about grub2 that I
> have that would have generated too many little emails.
>
> 1)lst files on a grub2 floppy
> ==
>
>   As I told you in another email, in order to build my grub2 floppy I did
> a soft link from /usr/local/lib/grub/i386-pc to
> /home/adrian/Desktop/gnu/grub2/grub2_2007_05_31 (compiled sources dir)
> and my floppy is full of lst files.
>
>   Usually in a grub2 floppy there are not any lst file, isn't it?
>
> 2) What are these lst files for, are they useful or are they like the C
> .o files, only needed for compilation purposes?

Most of them are for compilation.

> 3) Why any grub2.cfg file (I suppose it's the substitute for menu.lst)
> is inside the grub2 source code?

What do you mean?

> 4) Why any doc folder is inside the grub2 source code?

There is?  We need documentation...

> 5) grub2 lacks
> ==
> 5.1) pager
> -
>
> When I want to do a big ls the output does not stop screen by screen...
> Is there any hidden pager that I do not know?
> Maybe is not implemented yet?

set pager=1

It just isn't documented :-/

> 5.2) Chainload DEVICES
> 
>
> How the hell do you boot windows?
> Maybe from a file that has inside it the first 512 bytes from the
> Windows partition?

chainload (hd0,1)+
boot

(depending on the partition it is on, of course)

> 6) Compulsory Argument dilemma
>   
> If I run help I can seen things like this:
>   
> ls [-f|-l|-s] NAME
>
> and
>
> [ EXPRESSION ]

Yes?

> If [ ] means optional it should also mean optional in the case of the
> test alias [ .!!!

What do you mean?

> 7) set help incomplete
> 
> Set help should say that if no argument is set then it shows all the
> environment variables.

Why would it?  Only using set shows all env. variables.

> 8) exported and no exported variables
> ===
> Why the set does not show any difference (like a * in the beginning)
> about the exported and no exported variables (with the export command)

It isn't implemented :-)

> 9) help does not complain when no command help is available
> =
>
> The commands:
>   help marco_g
>   help okuji
>   help dachaac
>
> do not complain at all, and it is not a "hidden pascua egg" from these
> people,... any non-command has the same answer: NONE.

I don't need help, GRUB 2 does ;-)

> I think there should be something like:
>
> Error: This command does not exist.
>
> Or better even: It should prompt all the commands.

How it currently works is looking at the first characters.  For
example try "help l".

> 10) help --all
> =
> In grub-legacy when typing help some commands were some sort of hidden.
> However if you typed help --all these commands were also shown.
>
> Do we need this functionality in grub2?

Are there hidden commands for which this is important?  In that case,
yes.

> 11) help help
> ===
> Running help help says:
> Usage: help [PATTERN ...]
> Show a help message.
>
> It should say that if no argument is entered then all the commands are
> shown.
> And it should say: Show a command help described in PATTERN. (Or
> something like this).

Feel free to send in patches.

> 12) ls and -h argument
> 
>
> This is not an error but it curious. You can ask for the help of command
> with this:
> command -h
> however
> ls -h
> works in a different way.
>
> I suppose we may have the same problem with '-u' in the future.

Ehm, I am not sure.  You mean `-h' is short for help and we should
remove it?

--
Marco



___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


Re: grub2 miscelanea questions (2/2)

2007-06-05 Thread Marco Gerards
adrian15 <[EMAIL PROTECTED]> writes:

> Comes from grub2 miscelanea questions (1/2)
>
>
> 14) help linux
> =
> Usage: linux FILE [ARGS...]
> Load a linux kernel.
>
> I think that a message telling the user that the ARGS are arguments for
> the linux kernel instead of arguments for the grub's linux command would
> be a good idea.

The loader itself also has arguments.  Perhaps the documentation can
be improved.

> 15) lsmod
> ==
>
> As long as I am unable to run a pager can anyone tell me what the three
> columns mean?
>
> cat   1   normal,gzio
> gzio  6   
> boot  1   normal

The number of references to the command and the modules it refers to

> 16) help play
> ===
>
> Usage: play FILE
> Play a tune
>
> What is the FILE format? Is it an AIFF, an AU, a WAV, or is it an ASCII
> file that has tones?
>
> I should not go to the source code for knowing it.

ASCII IIRC.  Vicent has some tunes somewhere :-).  Perhaps they are
already included somewhere.

[...]

> 18) source, . , and configfile
> =
>
> If both source and '.' commands say that:
> Load another config file without changing context.
> Then the configfile command should say:
> Load another config file (with a new context)
> instead of saying:
> Load another config file.

Right, they are not the same.

> 19) rescue and exit failure on qemu
> ==
> I think that booting from my computer does not give this error.
> If I boot from QEMU and type:
>
> grub> rescue
> and then :
> grub rescue> exit
>
> it says: FATAL: INT18: BOOT FAILURE

Weird.  Can you debug this?

> 20) grub rescue help
> 
>
> help : Types the commands and a minimal explanation: OK
> help any_command : Types the commands and a minimal explanation: NOT OK
> help not_a_command : Types the commands and a minimal explanation: NOT OK

huh?

> 21) grub rescue exit help
> ===
> When you are in grub rescue mode and you type help the exit line it's
> the following one:
>
> exit  exit from GRUB
>
> Should it not prompt ?
>
> exit  exit from GRUB rescue

The exit command terminates GRUB and continues the boot process, IIRC.

> 22) copyright message missing
> 
> Why isn't there (when Grub is running) any message about the GRUB
> Copyright and the GPL license and that you should have received and this
> and that?

Why should there be such message?

> Is it a memory problem? (In grub legacy there was not any message like
> this either)

No, memory is not an issue.

> Maybe we should implement an 'about' command and run it when booting :) ?

Perhaps, but I don't see the added value.

> 23) set read only variables
> ==
> unset prefix lets me "delete" the prefix variable.
> unset root does not let me the "root" variable.
>
> I remember that bash has an option to set read only variables.
> Maybe the root variable is a read only variable?

You can easily modify the code.  But I do not like making such
variables read-only.

> 24) 'Command' commands
> ==
> Is there any special reason why the
> rescue, set, unset, export, insmod, rmmod, lsmod commands are in a
> single file called: normal/command.c
> instead of being in separate files in commands/ folder ?

Yes, there is.  First of all the commands are quite trivial.  Besides
that, these commands are really the core of GRUB 2.  The same commands
are hardcoded into rescue mode as well.

--
Marco



___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


Grub overwrites LVM

2007-06-05 Thread jean-christophe . haessig
Hello,

I used Grub for a long time, but I switched to LVM some months
ago and I realized I couldn't use grub anymore so I switched
back to Lilo.

Since then, I followed Grub development and tried to return to a
Grub-and-full-LVM setup. When installed on a floppy disk, the
latest Grub can boot my machine. However, installing the
bootloader on the first harddisk fries the LVM metadata...

The setup procedure wants to embed the core image (29k, about
60 sectors) right after the first sector, which is inappropriate,
since the LVM labels sit here (Sectors 2, 5 and next contain
the volume ID and the metadata ring buffer). Fortunately thanks
to vgcfgrestore the volumes can be easily recovered.

To be clear : my disks are NOT dos-partitioned.

I don't understand why the core image can't stay on /boot and the
boot image be patched with a blocklist. Can someone help ?

Thanks,
JC



___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel