Linux-SPDX Archive on lore.kernel.org
 help / color / Atom feed
* spdxcheck.py complains about the second OR?
@ 2019-11-01  4:25 Masahiro Yamada
  2019-11-04 22:11 ` Thomas Gleixner
  0 siblings, 1 reply; 9+ messages in thread
From: Masahiro Yamada @ 2019-11-01  4:25 UTC (permalink / raw)
  To: Thomas Gleixner; +Cc: Greg Kroah-Hartman, linux-spdx, Linux Kernel Mailing List

Hi.

scripts/spdxcheck.py warns the following two files.

$ ./scripts/spdxcheck.py
drivers/net/ethernet/pensando/ionic/ionic_if.h: 1:52 Syntax error: OR
drivers/net/ethernet/pensando/ionic/ionic_regs.h: 1:52 Syntax error: OR


I do not understand what is wrong with them.

I think "A OR B OR C" is sane.


-- 
Best Regards
Masahiro Yamada

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

* Re: spdxcheck.py complains about the second OR?
  2019-11-01  4:25 spdxcheck.py complains about the second OR? Masahiro Yamada
@ 2019-11-04 22:11 ` Thomas Gleixner
  2019-11-04 22:24   ` Joe Perches
  2019-11-04 23:53   ` Christoph Hellwig
  0 siblings, 2 replies; 9+ messages in thread
From: Thomas Gleixner @ 2019-11-04 22:11 UTC (permalink / raw)
  To: Masahiro Yamada; +Cc: Greg Kroah-Hartman, linux-spdx, Linux Kernel Mailing List

On Fri, 1 Nov 2019, Masahiro Yamada wrote:
> scripts/spdxcheck.py warns the following two files.
> 
> $ ./scripts/spdxcheck.py
> drivers/net/ethernet/pensando/ionic/ionic_if.h: 1:52 Syntax error: OR
> drivers/net/ethernet/pensando/ionic/ionic_regs.h: 1:52 Syntax error: OR
> 
> I do not understand what is wrong with them.
> 
> I think "A OR B OR C" is sane.

Yes it is, but obviously we did not expect files with 3 possible
alternative licenses.

Thanks,

	tglx

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

* Re: spdxcheck.py complains about the second OR?
  2019-11-04 22:11 ` Thomas Gleixner
@ 2019-11-04 22:24   ` Joe Perches
  2019-11-05 10:11     ` Zavras, Alexios
  2019-11-05 15:47     ` Christoph Hellwig
  2019-11-04 23:53   ` Christoph Hellwig
  1 sibling, 2 replies; 9+ messages in thread
From: Joe Perches @ 2019-11-04 22:24 UTC (permalink / raw)
  To: Thomas Gleixner, Masahiro Yamada
  Cc: Greg Kroah-Hartman, linux-spdx, Linux Kernel Mailing List

On Mon, 2019-11-04 at 23:11 +0100, Thomas Gleixner wrote:
> On Fri, 1 Nov 2019, Masahiro Yamada wrote:
> > scripts/spdxcheck.py warns the following two files.
> > 
> > $ ./scripts/spdxcheck.py
> > drivers/net/ethernet/pensando/ionic/ionic_if.h: 1:52 Syntax error: OR
> > drivers/net/ethernet/pensando/ionic/ionic_regs.h: 1:52 Syntax error: OR
> > 
> > I do not understand what is wrong with them.
> > 
> > I think "A OR B OR C" is sane.
> 
> Yes it is, but obviously we did not expect files with 3 possible
> alternative licenses.

Perhaps just this, but the generic logic
obviously isn't complete.
---
 scripts/spdxcheck.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/scripts/spdxcheck.py b/scripts/spdxcheck.py
index 6374e0..00be34 100755
--- a/scripts/spdxcheck.py
+++ b/scripts/spdxcheck.py
@@ -150,6 +150,7 @@ class id_parser(object):
                 | ID WITH EXC
                 | expr AND expr
                 | expr OR expr
+                | expr OR expr OR expr
                 | LPAR expr RPAR'''
         pass
 



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

* Re: spdxcheck.py complains about the second OR?
  2019-11-04 22:11 ` Thomas Gleixner
  2019-11-04 22:24   ` Joe Perches
@ 2019-11-04 23:53   ` Christoph Hellwig
       [not found]     ` <CAG_66ZQ3f39bv=0Yw=Eum0vcxbf94mmXE9jdJUpi6+gEEqkS8A@mail.gmail.com>
  1 sibling, 1 reply; 9+ messages in thread
From: Christoph Hellwig @ 2019-11-04 23:53 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: Masahiro Yamada, Greg Kroah-Hartman, linux-spdx,
	Linux Kernel Mailing List

On Mon, Nov 04, 2019 at 11:11:53PM +0100, Thomas Gleixner wrote:
> On Fri, 1 Nov 2019, Masahiro Yamada wrote:
> > scripts/spdxcheck.py warns the following two files.
> > 
> > $ ./scripts/spdxcheck.py
> > drivers/net/ethernet/pensando/ionic/ionic_if.h: 1:52 Syntax error: OR
> > drivers/net/ethernet/pensando/ionic/ionic_regs.h: 1:52 Syntax error: OR
> > 
> > I do not understand what is wrong with them.
> > 
> > I think "A OR B OR C" is sane.
> 
> Yes it is, but obviously we did not expect files with 3 possible
> alternative licenses.

And I'm kinda happy about this warning because people are overdoing it.
There is no point for the Linux-OpenIB license in this case, as it
is just a BSD license with copy and paste errors.  I think the right
fix is to ask the authors to just drop it.

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

* RE: spdxcheck.py complains about the second OR?
  2019-11-04 22:24   ` Joe Perches
@ 2019-11-05 10:11     ` Zavras, Alexios
  2019-11-05 15:10       ` Joe Perches
  2019-11-05 15:47     ` Christoph Hellwig
  1 sibling, 1 reply; 9+ messages in thread
From: Zavras, Alexios @ 2019-11-05 10:11 UTC (permalink / raw)
  To: Joe Perches, Thomas Gleixner
  Cc: Greg Kroah-Hartman, linux-spdx, Linux Kernel Mailing List,
	Masahiro Yamada

This is not correct.
Since the grammar includes the production "expr: expr OR expr",
there is absolutely no need to add a rule with more than two operands --
it will be handled recursively.

-- zvr

-----Original Message-----
From: linux-spdx-owner@vger.kernel.org <linux-spdx-owner@vger.kernel.org> On Behalf Of Joe Perches
Sent: Monday, 4 November, 2019 23:24
To: Thomas Gleixner <tglx@linutronix.de>; Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>; linux-spdx@vger.kernel.org; Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: spdxcheck.py complains about the second OR?

On Mon, 2019-11-04 at 23:11 +0100, Thomas Gleixner wrote:
> On Fri, 1 Nov 2019, Masahiro Yamada wrote:
> > scripts/spdxcheck.py warns the following two files.
> > 
> > $ ./scripts/spdxcheck.py
> > drivers/net/ethernet/pensando/ionic/ionic_if.h: 1:52 Syntax error: 
> > OR
> > drivers/net/ethernet/pensando/ionic/ionic_regs.h: 1:52 Syntax error: 
> > OR
> > 
> > I do not understand what is wrong with them.
> > 
> > I think "A OR B OR C" is sane.
> 
> Yes it is, but obviously we did not expect files with 3 possible 
> alternative licenses.

Perhaps just this, but the generic logic obviously isn't complete.
---
 scripts/spdxcheck.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/scripts/spdxcheck.py b/scripts/spdxcheck.py index 6374e0..00be34 100755
--- a/scripts/spdxcheck.py
+++ b/scripts/spdxcheck.py
@@ -150,6 +150,7 @@ class id_parser(object):
                 | ID WITH EXC
                 | expr AND expr
                 | expr OR expr
+                | expr OR expr OR expr
                 | LPAR expr RPAR'''
         pass
 


Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Gary Kershaw
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928


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

* Re: spdxcheck.py complains about the second OR?
       [not found]     ` <CAG_66ZQ3f39bv=0Yw=Eum0vcxbf94mmXE9jdJUpi6+gEEqkS8A@mail.gmail.com>
@ 2019-11-05 14:28       ` Christoph Hellwig
  0 siblings, 0 replies; 9+ messages in thread
From: Christoph Hellwig @ 2019-11-05 14:28 UTC (permalink / raw)
  To: Kate Stewart
  Cc: Christoph Hellwig, Thomas Gleixner, Masahiro Yamada,
	Greg Kroah-Hartman, linux-spdx, Linux Kernel Mailing List

On Tue, Nov 05, 2019 at 01:39:39AM -0600, Kate Stewart wrote:
> Unfortunately those copy and paste errors introduced new legal terms which
> made it,  its own license.

FYI, I meant there is no reason for this brand new driver to tripple license
2 files under BSD2 clause and OpenIB.  (Or using the OpenIB license for
anything new for that matter).

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

* Re: spdxcheck.py complains about the second OR?
  2019-11-05 10:11     ` Zavras, Alexios
@ 2019-11-05 15:10       ` Joe Perches
  2019-11-11  9:37         ` Zavras, Alexios
  0 siblings, 1 reply; 9+ messages in thread
From: Joe Perches @ 2019-11-05 15:10 UTC (permalink / raw)
  To: Zavras, Alexios, Thomas Gleixner
  Cc: Greg Kroah-Hartman, linux-spdx, Linux Kernel Mailing List,
	Masahiro Yamada

On Tue, 2019-11-05 at 10:11 +0000, Zavras, Alexios wrote:
> This is not correct.
> Since the grammar includes the production "expr: expr OR expr",
> there is absolutely no need to add a rule with more than two operands --
> it will be handled recursively.

You sure about the recursion?

It does work and spdxcheck no longer emits a message for
these two files.

> -- zvr
> 
> -----Original Message-----
> From: linux-spdx-owner@vger.kernel.org <linux-spdx-owner@vger.kernel.org> On Behalf Of Joe Perches
> Sent: Monday, 4 November, 2019 23:24
> To: Thomas Gleixner <tglx@linutronix.de>; Masahiro Yamada <yamada.masahiro@socionext.com>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>; linux-spdx@vger.kernel.org; Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
> Subject: Re: spdxcheck.py complains about the second OR?
> 
> On Mon, 2019-11-04 at 23:11 +0100, Thomas Gleixner wrote:
> > On Fri, 1 Nov 2019, Masahiro Yamada wrote:
> > > scripts/spdxcheck.py warns the following two files.
> > > 
> > > $ ./scripts/spdxcheck.py
> > > drivers/net/ethernet/pensando/ionic/ionic_if.h: 1:52 Syntax error: 
> > > OR
> > > drivers/net/ethernet/pensando/ionic/ionic_regs.h: 1:52 Syntax error: 
> > > OR
> > > 
> > > I do not understand what is wrong with them.
> > > 
> > > I think "A OR B OR C" is sane.
> > 
> > Yes it is, but obviously we did not expect files with 3 possible 
> > alternative licenses.
> 
> Perhaps just this, but the generic logic obviously isn't complete.
> ---
>  scripts/spdxcheck.py | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/scripts/spdxcheck.py b/scripts/spdxcheck.py index 6374e0..00be34 100755
> --- a/scripts/spdxcheck.py
> +++ b/scripts/spdxcheck.py
> @@ -150,6 +150,7 @@ class id_parser(object):
>                  | ID WITH EXC
>                  | expr AND expr
>                  | expr OR expr
> +                | expr OR expr OR expr
>                  | LPAR expr RPAR'''
>          pass
>  
> 
> 
> Intel Deutschland GmbH
> Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
> Tel: +49 89 99 8853-0, www.intel.de
> Managing Directors: Christin Eisenschmid, Gary Kershaw
> Chairperson of the Supervisory Board: Nicole Lau
> Registered Office: Munich
> Commercial Register: Amtsgericht Muenchen HRB 186928
> 


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

* Re: spdxcheck.py complains about the second OR?
  2019-11-04 22:24   ` Joe Perches
  2019-11-05 10:11     ` Zavras, Alexios
@ 2019-11-05 15:47     ` Christoph Hellwig
  1 sibling, 0 replies; 9+ messages in thread
From: Christoph Hellwig @ 2019-11-05 15:47 UTC (permalink / raw)
  To: Joe Perches
  Cc: Thomas Gleixner, Masahiro Yamada, Greg Kroah-Hartman, linux-spdx,
	Linux Kernel Mailing List

On Mon, Nov 04, 2019 at 02:24:23PM -0800, Joe Perches wrote:
> On Mon, 2019-11-04 at 23:11 +0100, Thomas Gleixner wrote:
> > On Fri, 1 Nov 2019, Masahiro Yamada wrote:
> > > scripts/spdxcheck.py warns the following two files.
> > > 
> > > $ ./scripts/spdxcheck.py
> > > drivers/net/ethernet/pensando/ionic/ionic_if.h: 1:52 Syntax error: OR
> > > drivers/net/ethernet/pensando/ionic/ionic_regs.h: 1:52 Syntax error: OR
> > > 
> > > I do not understand what is wrong with them.
> > > 
> > > I think "A OR B OR C" is sane.
> > 
> > Yes it is, but obviously we did not expect files with 3 possible
> > alternative licenses.
> 
> Perhaps just this, but the generic logic
> obviously isn't complete.

Can we please print a warning in that case even if we end up parsing
it correct?  tripple licensing always has a bit of a bad smell.

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

* RE: spdxcheck.py complains about the second OR?
  2019-11-05 15:10       ` Joe Perches
@ 2019-11-11  9:37         ` Zavras, Alexios
  0 siblings, 0 replies; 9+ messages in thread
From: Zavras, Alexios @ 2019-11-11  9:37 UTC (permalink / raw)
  To: Joe Perches, Thomas Gleixner
  Cc: Greg Kroah-Hartman, linux-spdx, Linux Kernel Mailing List

Sorry for the delay in replying.
I've never used PLY before, but I do know lex and yacc, so I'm confident that an expression with two (or more) "OR" terms will be handled recursively.

The problem with spdxcheck.py is, I think, that it specifies "nonassoc" in the precedence variable, which effectively means that constructs like "a OR b OR c" are not allowed and need to be "(a OR b) OR c". I expect simply deleting this string would make everything pass.

The following standalone test code shows that there is no need for any additional rule in the grammar (the first tests succeed, the last two fail with lexical and parsing errors, respectively):

#!/usr/bin/env python3

import ply.lex as lex
import ply.yacc as yacc

tokens = ( 'ID', 'OR', 'AND', 'LPAR', 'RPAR',)

t_ID = r'[a-z]+'
t_OR = 'OR'
t_AND = 'AND'
t_LPAR  = r'\('
t_RPAR  = r'\)'
t_ignore  = ' \t\n'

def p_expr(p):
    '''expr : ID
        | expr AND expr
        | expr OR expr
        | LPAR expr RPAR'''

def t_error(t):
    print("Illegal character '%s'" % t.value[0])
    t.lexer.skip(1)

def p_error(p):
    print("Syntax error in input!", p)


lexer = lex.lex()
parser = yacc.yacc()

tests = ( 'a', 'a OR b', 'a AND b', 'a OR b OR c', 'a OR b AND c OR d',
        'a AND @', 'a OR OR b')
for s in tests:
    print(s)
    parser.parse(s)

#EOF----------------------------------------------------------------

-- zvr

-----Original Message-----
From: Joe Perches <joe@perches.com> 
Sent: Tuesday, 5 November, 2019 16:11
To: Zavras, Alexios <alexios.zavras@intel.com>; Thomas Gleixner <tglx@linutronix.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>; linux-spdx@vger.kernel.org; Linux Kernel Mailing List <linux-kernel@vger.kernel.org>; Masahiro Yamada <yamada.masahiro@socionext.com>
Subject: Re: spdxcheck.py complains about the second OR?

On Tue, 2019-11-05 at 10:11 +0000, Zavras, Alexios wrote:
> This is not correct.
> Since the grammar includes the production "expr: expr OR expr", there 
> is absolutely no need to add a rule with more than two operands -- it 
> will be handled recursively.

You sure about the recursion?

It does work and spdxcheck no longer emits a message for these two files.

> -- zvr
> 
> -----Original Message-----
> From: linux-spdx-owner@vger.kernel.org 
> <linux-spdx-owner@vger.kernel.org> On Behalf Of Joe Perches
> Sent: Monday, 4 November, 2019 23:24
> To: Thomas Gleixner <tglx@linutronix.de>; Masahiro Yamada 
> <yamada.masahiro@socionext.com>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>; 
> linux-spdx@vger.kernel.org; Linux Kernel Mailing List 
> <linux-kernel@vger.kernel.org>
> Subject: Re: spdxcheck.py complains about the second OR?
> 
> On Mon, 2019-11-04 at 23:11 +0100, Thomas Gleixner wrote:
> > On Fri, 1 Nov 2019, Masahiro Yamada wrote:
> > > scripts/spdxcheck.py warns the following two files.
> > > 
> > > $ ./scripts/spdxcheck.py
> > > drivers/net/ethernet/pensando/ionic/ionic_if.h: 1:52 Syntax error: 
> > > OR
> > > drivers/net/ethernet/pensando/ionic/ionic_regs.h: 1:52 Syntax error: 
> > > OR
> > > 
> > > I do not understand what is wrong with them.
> > > 
> > > I think "A OR B OR C" is sane.
> > 
> > Yes it is, but obviously we did not expect files with 3 possible 
> > alternative licenses.
> 
> Perhaps just this, but the generic logic obviously isn't complete.
> ---
>  scripts/spdxcheck.py | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/scripts/spdxcheck.py b/scripts/spdxcheck.py index 
> 6374e0..00be34 100755
> --- a/scripts/spdxcheck.py
> +++ b/scripts/spdxcheck.py
> @@ -150,6 +150,7 @@ class id_parser(object):
>                  | ID WITH EXC
>                  | expr AND expr
>                  | expr OR expr
> +                | expr OR expr OR expr
>                  | LPAR expr RPAR'''
>          pass
>  
> 
> 
> Intel Deutschland GmbH
> Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
> Tel: +49 89 99 8853-0, www.intel.de
> Managing Directors: Christin Eisenschmid, Gary Kershaw Chairperson of 
> the Supervisory Board: Nicole Lau Registered Office: Munich Commercial 
> Register: Amtsgericht Muenchen HRB 186928
> 

Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Gary Kershaw
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928


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

end of thread, back to index

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-01  4:25 spdxcheck.py complains about the second OR? Masahiro Yamada
2019-11-04 22:11 ` Thomas Gleixner
2019-11-04 22:24   ` Joe Perches
2019-11-05 10:11     ` Zavras, Alexios
2019-11-05 15:10       ` Joe Perches
2019-11-11  9:37         ` Zavras, Alexios
2019-11-05 15:47     ` Christoph Hellwig
2019-11-04 23:53   ` Christoph Hellwig
     [not found]     ` <CAG_66ZQ3f39bv=0Yw=Eum0vcxbf94mmXE9jdJUpi6+gEEqkS8A@mail.gmail.com>
2019-11-05 14:28       ` Christoph Hellwig

Linux-SPDX Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-spdx/0 linux-spdx/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-spdx linux-spdx/ https://lore.kernel.org/linux-spdx \
		linux-spdx@vger.kernel.org
	public-inbox-index linux-spdx

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-spdx


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git