Contribution
A message that is not in the archive (sent off-list or not yet received): [email protected]
Thank you for your kind reply, Vladimir. I failed to find the probe command - I promise - I spent quite a few hours digging through the source. As for the $((...)) and $[...] - I'll look into it.
It seems that my paltry contributions are not needed, after all.
Nicole
Quoted 51 lines
Date: Wed, 12 Apr 2017 10:41:19 +0000
From: "Vladimir 'phcoder' Serbinenko" <[email protected]>
To: The development of GNU GRUB <[email protected]>
Subject: Re: Contribution
Message-ID:<CAEaD8JNP896sLDK90ERqZT6i38WD1g8Wy1DwrnoneKQ2zka5Vw@mail.gmail.com>Content-Type: text/plain; charset="utf-8"
Quoted 6 lines · On Wed, Apr 12, 2017, 20:37 Nicole <[email protected]> wrote:
I have written two small, simple modules to address limitations I found in in Grub.
1. does simple arithmetic - nothing fancy. It's invoked by using something like this:
Quoted 8 lines
insmod arithmetic
arithmetic --set fred --min 2 -- max 10 "1" "+" "2"the operators supported are unary -,!; binary +,-,/,*,%,<,<=,<.<=,!=,== --set works in the usual way. If the result is greater than --max, the --min value is returned and vice versa; this useful for cycling round a group of partitions in a round-robin fashion
Can you have a look if we can have bash syntax $((...)) and $[...] instead? It's more compact and nicer.
Quoted 7 lines
2. diskinfo.mod introduces two commands: disklabel, diskuuid which return the label and uuid of the specified disk partition. This is useful where, having decided which partition, amongst several, to boot, you can fill in the appropriate value in the "root=UUID=" or "root=label=" Linux kernel parameter.
Have a look at probe command. Does it cover your usecase?
Quoted 4 lines
I looked for details on how to submit new modules, but failed to find anything. How do I go about this?
Just send patches here.
Quoted 9 lines
Nicole
_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
Nicole schreef op 12-04-2017 18:51:
Quoted 5 lines
Thank you for your kind reply, Vladimir. I failed to find the probe command - I promise - I spent quite a few hours digging through the source. As for the $((...)) and $[...] - I'll look into it.
It seems that my paltry contributions are not needed, after all.
Bash syntax will not have the min/max behaviour though unless you use a kind of modulo which will make it complex.
ie. normally you would do that with: x = (x + 1) mod 4, or x = (x - 1 + 4) mod 4.
although I'm not sure a standard "round robin" function like that would be meaningful but who knows.
so the " arithmetic --set fred --min 2 -- max 10 "1" "+" "2" "
will come down to
fred=$(( (((fred-2) + 1) % 8) + 2 )) -- I assume. Or if you still had those min/max functions it'd come down to ?
arithmetic --set fred --min 2 --max 10 $(( fred + 1 )) ?
Regards.
Quoted 10 lines · On Thu, Apr 13, 2017, 03:04 Xen <[email protected]> wrote:
Nicole schreef op 12-04-2017 18:51:
Quoted 5 lines
Thank you for your kind reply, Vladimir. I failed to find the probe command - I promise - I spent quite a few hours digging through the source. As for the $((...)) and $[...] - I'll look into it.
It seems that my paltry contributions are not needed, after all.
Bash syntax will not have the min/max behaviour though unless you use a kind of modulo which will make it complex.
There is a $[a>b?a:b] syntax
Quoted 23 lines
ie. normally you would do that with: x = (x + 1) mod 4, or x = (x - 1 +
4) mod 4.although I'm not sure a standard "round robin" function like that would be meaningful but who knows.
so the " arithmetic --set fred --min 2 -- max 10 "1" "+" "2" "
will come down to
fred=$(( (((fred-2) + 1) % 8) + 2 )) -- I assume. Or if you still had those min/max functions it'd come down to ?
arithmetic --set fred --min 2 --max 10 $(( fred + 1 )) ?
Regards.
_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
Re: Contributions
In reply to a message not in the archiveI've looked carefully at both the parser and the lexer. It's a long while since I've used either of these tools, but I can find no reference to anything that does arithmetic. The only instance of plus signs that I can find are in the regular expressions and in the C code. There appears to be no provision to recognise a "$((" - the parser seems to expect only a variable name (with or without enclosing braces). "$[" is used for arrays in bash - in any case the lexer doesn't recognise it.
Nicole
Re: Contributions
Quoted 8 lines · On Thu, Apr 13, 2017, 04:25 Nicole <[email protected]> wrote:
I've looked carefully at both the parser and the lexer. It's a long while since I've used either of these tools, but I can find no reference to anything that does arithmetic. The only instance of plus signs that I can find are in the regular expressions and in the C code. There appears to be no provision to recognise a "$((" - the parser seems to expect only a variable name (with or without enclosing braces). "$[" is used for arrays in bash - in any case the lexer doesn't recognise it.
I think you misunderstood me. The is no arithmetic currently. What I meant is that they may be better integrated if they are done using bash syntax rather than by having a separate command.
Quoted 8 lines
Nicole
_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel