Re: [PATCH] fix exception running gen-make.py

2013-08-18 Thread Daniel Shahaf
Masaru Tsuchiyama wrote on Sun, Aug 18, 2013 at 22:58:09 +0900: >> To further explain this consideration: even if both existence and >> permissions were checked, the code would *still* be wrong if args[0] >> were a directory. If an .isdir() check were added, the code would >> still be wrong if arg

Re: [PATCH] fix exception running gen-make.py

2013-08-18 Thread Masaru Tsuchiyama
To further explain this consideration: even if both existence and permissions were checked, the code would *still* be wrong if args[0] were a directory. If an .isdir() check were added, the code would still be wrong if args[0] were a dangling symlink. And so on. Calling open() will detect all t

Re: [PATCH] fix exception running gen-make.py

2013-08-18 Thread Daniel Shahaf
Daniel Shahaf wrote on Sun, Aug 18, 2013 at 16:30:45 +0300: > Masaru Tsuchiyama wrote on Sun, Aug 18, 2013 at 22:13:54 +0900: > > Daniel Shahaf wrote: > >> I think that's the wrong fix. Input validation should be done by > >> checking that the input is valid, not by ruling out every known invalid

Re: [PATCH] fix exception running gen-make.py

2013-08-18 Thread Daniel Shahaf
Masaru Tsuchiyama wrote on Sun, Aug 18, 2013 at 22:13:54 +0900: > Daniel Shahaf wrote: >> I think that's the wrong fix. Input validation should be done by >> checking that the input is valid, not by ruling out every known invalid >> value.[1] In this case: by checking os.path.exists() at the poin

Re: [PATCH] fix exception running gen-make.py

2013-08-18 Thread Masaru Tsuchiyama
Daniel Shahaf wrote: I think that's the wrong fix. Input validation should be done by checking that the input is valid, not by ruling out every known invalid value.[1] In this case: by checking os.path.exists() at the point in the code that tries to interpret the argument as a filename. Fixed

Re: [PATCH] fix exception running gen-make.py

2013-08-18 Thread Daniel Shahaf
> Index: gen-make.py > === > --- gen-make.py (revision 1514179) > +++ gen-make.py (working copy) > @@ -278,6 +278,9 @@ if __name__ == '__main__': >except getopt.GetoptError, e: > _usage_exit(str(e)) > > + if arg

Re: [PATCH] fix exception running gen-make.py

2013-08-14 Thread Masaru Tsuchiyama
(2013/08/08 0:15), Daniel Shahaf wrote: masaru tsuchiyama wrote on Thu, Aug 01, 2013 at 00:11:30 +0900: * gen-make.py () : use default value as conf when args[0] is line ending. I don't use windows, but I think the right fix in this case is to prevent ("\n" in sys.argv) from becoming true

Re: [PATCH] fix exception running gen-make.py

2013-08-07 Thread Daniel Shahaf
masaru tsuchiyama wrote on Thu, Aug 01, 2013 at 00:11:30 +0900: > * gen-make.py >() : use default value as conf when args[0] is line ending. I don't use windows, but I think the right fix in this case is to prevent ("\n" in sys.argv) from becoming true in the first place.

Re: [PATCH] fix exception running gen-make.py

2013-08-06 Thread Masaru Tsuchiyama
Hi. Does anybody comment my patch? (2013/08/01 0:11), masaru tsuchiyama wrote: Hi I attach a patch to fix exception when running gen-make.py by the attached bat file which contains line ending after last ^. ( I rename the bat file to txt for security reason) [[[ Fix exception when the argumen