mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* Possible bug in insmod or the kernel?
@ 2010-02-07 18:56 Larry Homes
  2010-02-07 22:14 ` andrew hendry
  0 siblings, 1 reply; 6+ messages in thread
From: Larry Homes @ 2010-02-07 18:56 UTC (permalink / raw)
  To: linux-kernel

Hello,

I am very new to kernel development and I was playing around with
making modules. I found I could not retrieve commandline parameters in
the module if the parameter has whitespace in it. I thought it was my
lack of knowledge that was causing the error (and I still do
honestly), but I made a forum post here
http://forum.kernelnewbies.org/read.php?17,1354 regarding the issue,
and someone suggested it may be a bug and I should post on LKML.

The forum post shows example code to demonstrate the issue. I am using
archlinux and the latest kernel. I am not sure what other information
you need, so feel free to ask for anything.


Thanks

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

* Re: Possible bug in insmod or the kernel?
  2010-02-07 18:56 Possible bug in insmod or the kernel? Larry Homes
@ 2010-02-07 22:14 ` andrew hendry
  2010-02-08 18:13   ` Larry Homes
  0 siblings, 1 reply; 6+ messages in thread
From: andrew hendry @ 2010-02-07 22:14 UTC (permalink / raw)
  To: Larry Homes; +Cc: linux-kernel

have a look around kernel/params.c
/* You can use " around spaces, but can't escape ". */
/* Hyphens and underscores equivalent in parameter names. */
static char *next_arg(char *args, char **param, char **val)

Your printks are probably showing the single quotes? probably not what
you want in your name

On Mon, Feb 8, 2010 at 5:56 AM, Larry Homes <larr.homes@gmail.com> wrote:
> Hello,
>
> I am very new to kernel development and I was playing around with
> making modules. I found I could not retrieve commandline parameters in
> the module if the parameter has whitespace in it. I thought it was my
> lack of knowledge that was causing the error (and I still do
> honestly), but I made a forum post here
> http://forum.kernelnewbies.org/read.php?17,1354 regarding the issue,
> and someone suggested it may be a bug and I should post on LKML.
>
> The forum post shows example code to demonstrate the issue. I am using
> archlinux and the latest kernel. I am not sure what other information
> you need, so feel free to ask for anything.
>
>
> Thanks
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
>

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

* Re: Possible bug in insmod or the kernel?
  2010-02-07 22:14 ` andrew hendry
@ 2010-02-08 18:13   ` Larry Homes
  2010-02-08 18:43     ` Nick Bowler
  0 siblings, 1 reply; 6+ messages in thread
From: Larry Homes @ 2010-02-08 18:13 UTC (permalink / raw)
  To: andrew hendry; +Cc: linux-kernel

No, the problem is not that the quotes are showing. The problem is
that as soon as it sees a space, it assumes the following is the next
parameters name. So for example:

[root@myhost modules]# insmod hello3.ko name="john smith"
insmod: error inserting 'hello3.ko': -1 Unknown symbol in module

[root@myhost modules]# insmod hello3.ko "name=john smith"
insmod: error inserting 'hello3.ko': -1 Unknown symbol in module

In both cases, dmesg shows:

hello3: Unknown parameter `smith'

I looked at the params.c code and it seems like the above should work.

On Sun, Feb 7, 2010 at 5:14 PM, andrew hendry <andrew.hendry@gmail.com> wrote:
> have a look around kernel/params.c
> /* You can use " around spaces, but can't escape ". */
> /* Hyphens and underscores equivalent in parameter names. */
> static char *next_arg(char *args, char **param, char **val)
>
> Your printks are probably showing the single quotes? probably not what
> you want in your name
>
> On Mon, Feb 8, 2010 at 5:56 AM, Larry Homes <larr.homes@gmail.com> wrote:
>> Hello,
>>
>> I am very new to kernel development and I was playing around with
>> making modules. I found I could not retrieve commandline parameters in
>> the module if the parameter has whitespace in it. I thought it was my
>> lack of knowledge that was causing the error (and I still do
>> honestly), but I made a forum post here
>> http://forum.kernelnewbies.org/read.php?17,1354 regarding the issue,
>> and someone suggested it may be a bug and I should post on LKML.
>>
>> The forum post shows example code to demonstrate the issue. I am using
>> archlinux and the latest kernel. I am not sure what other information
>> you need, so feel free to ask for anything.
>>
>>
>> Thanks
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>> Please read the FAQ at  http://www.tux.org/lkml/
>>
>

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

* Re: Possible bug in insmod or the kernel?
  2010-02-08 18:13   ` Larry Homes
@ 2010-02-08 18:43     ` Nick Bowler
  2010-02-08 18:47       ` Larry Homes
  0 siblings, 1 reply; 6+ messages in thread
From: Nick Bowler @ 2010-02-08 18:43 UTC (permalink / raw)
  To: Larry Homes; +Cc: andrew hendry, linux-kernel

On 13:13 Mon 08 Feb     , Larry Homes wrote:
> No, the problem is not that the quotes are showing. The problem is
> that as soon as it sees a space, it assumes the following is the next
> parameters name. So for example:
> 
> [root@myhost modules]# insmod hello3.ko name="john smith"
> insmod: error inserting 'hello3.ko': -1 Unknown symbol in module
> 
> [root@myhost modules]# insmod hello3.ko "name=john smith"
> insmod: error inserting 'hello3.ko': -1 Unknown symbol in module
> 
> In both cases, dmesg shows:
> 
> hello3: Unknown parameter `smith'
> 
> I looked at the params.c code and it seems like the above should work.

I'm not familiar with the code in question, but I suspect that it
expects to actually see the quotation marks in the parameter value, but
your shell is eating them.  Try

  insmod hello3.ko 'name="john smith"'

instead.

-- 
Nick Bowler, Elliptic Technologies (http://www.elliptictech.com/)

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

* Re: Possible bug in insmod or the kernel?
  2010-02-08 18:43     ` Nick Bowler
@ 2010-02-08 18:47       ` Larry Homes
  2010-02-09  2:23         ` Américo Wang
  0 siblings, 1 reply; 6+ messages in thread
From: Larry Homes @ 2010-02-08 18:47 UTC (permalink / raw)
  To: Larry Homes, andrew hendry, linux-kernel

That was it. The shell was eating the quotes. Thanks alot!

On Mon, Feb 8, 2010 at 1:43 PM, Nick Bowler <nbowler@elliptictech.com> wrote:
> On 13:13 Mon 08 Feb     , Larry Homes wrote:
>> No, the problem is not that the quotes are showing. The problem is
>> that as soon as it sees a space, it assumes the following is the next
>> parameters name. So for example:
>>
>> [root@myhost modules]# insmod hello3.ko name="john smith"
>> insmod: error inserting 'hello3.ko': -1 Unknown symbol in module
>>
>> [root@myhost modules]# insmod hello3.ko "name=john smith"
>> insmod: error inserting 'hello3.ko': -1 Unknown symbol in module
>>
>> In both cases, dmesg shows:
>>
>> hello3: Unknown parameter `smith'
>>
>> I looked at the params.c code and it seems like the above should work.
>
> I'm not familiar with the code in question, but I suspect that it
> expects to actually see the quotation marks in the parameter value, but
> your shell is eating them.  Try
>
>  insmod hello3.ko 'name="john smith"'
>
> instead.
>
> --
> Nick Bowler, Elliptic Technologies (http://www.elliptictech.com/)
>

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

* Re: Possible bug in insmod or the kernel?
  2010-02-08 18:47       ` Larry Homes
@ 2010-02-09  2:23         ` Américo Wang
  0 siblings, 0 replies; 6+ messages in thread
From: Américo Wang @ 2010-02-09  2:23 UTC (permalink / raw)
  To: Larry Homes; +Cc: andrew hendry, linux-kernel

On Tue, Feb 9, 2010 at 2:47 AM, Larry Homes <larr.homes@gmail.com> wrote:
> That was it. The shell was eating the quotes. Thanks alot!
>

When you met quote problems like this, just test them with echo. ;)
In this case, try:

 echo name="john smith"

Hope this helps.

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

end of thread, other threads:[~2010-02-09  2:23 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-02-07 18:56 Possible bug in insmod or the kernel? Larry Homes
2010-02-07 22:14 ` andrew hendry
2010-02-08 18:13   ` Larry Homes
2010-02-08 18:43     ` Nick Bowler
2010-02-08 18:47       ` Larry Homes
2010-02-09  2:23         ` Américo Wang

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

all inboxes | Powered by JetHome®