Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH] makedevs: rectify the exit codes and handle the invalid parameter
@ 2013-09-25  5:58 rongqing.li
  2013-09-25 14:27 ` Khem Raj
  0 siblings, 1 reply; 4+ messages in thread
From: rongqing.li @ 2013-09-25  5:58 UTC (permalink / raw)
  To: openembedded-core

From: Roy Li <rongqing.li@windriver.com>

It is correct behaviours to output help and version information,
and should return 0;
When input parameter is invalid, print help information and exit.

Signed-off-by: Roy Li <rongqing.li@windriver.com>
---
 meta/recipes-devtools/makedevs/makedevs-1.0.0/makedevs.c |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/meta/recipes-devtools/makedevs/makedevs-1.0.0/makedevs.c b/meta/recipes-devtools/makedevs/makedevs-1.0.0/makedevs.c
index cc3707b..5d2c45b 100644
--- a/meta/recipes-devtools/makedevs/makedevs-1.0.0/makedevs.c
+++ b/meta/recipes-devtools/makedevs/makedevs-1.0.0/makedevs.c
@@ -465,8 +465,8 @@ int main(int argc, char **argv)
 				error_msg_and_die("%s: not a proper device table file", optarg);
 			break;
 		case 'h':
-			fprintf(stderr, helptext);
-			exit(1);
+			printf(helptext);
+			exit(0);
 		case 'r':
 		case 'd':				/* for compatibility with mkfs.jffs, genext2fs, etc... */
 			if (rootdir != default_rootdir) {
@@ -476,8 +476,11 @@ int main(int argc, char **argv)
 			break;
 
 		case 'v':
-			fprintf(stderr, "makedevs revision %.*s\n",
+			printf("makedevs revision %.*s\n",
 					(int) strlen(revtext) - 13, revtext + 11);
+			exit(0);
+		default:
+			fprintf(stderr, helptext);
 			exit(1);
 		}
 	}
-- 
1.7.10.4



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

* Re: [PATCH] makedevs: rectify the exit codes and handle the invalid parameter
  2013-09-25  5:58 [PATCH] makedevs: rectify the exit codes and handle the invalid parameter rongqing.li
@ 2013-09-25 14:27 ` Khem Raj
  2013-09-25 14:55   ` Richard Purdie
  0 siblings, 1 reply; 4+ messages in thread
From: Khem Raj @ 2013-09-25 14:27 UTC (permalink / raw)
  To: rongqing.li@windriver.com; +Cc: openembedded-core@lists.openembedded.org

[-- Attachment #1: Type: text/plain, Size: 2341 bytes --]

On Tuesday, September 24, 2013, wrote:

> From: Roy Li <rongqing.li@windriver.com <javascript:;>>
>
> It is correct behaviours to output help and version information,
> and should return 0;
> When input parameter is invalid, print help information and exit.


This can cause gripes for systems who have scripted the old behavior
And since it's a user visible change I would suggest to get it accepted
upstream before
It's applied in openembedded


> Signed-off-by: Roy Li <rongqing.li@windriver.com <javascript:;>>
> ---
>  meta/recipes-devtools/makedevs/makedevs-1.0.0/makedevs.c |    9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/meta/recipes-devtools/makedevs/makedevs-1.0.0/makedevs.c
> b/meta/recipes-devtools/makedevs/makedevs-1.0.0/makedevs.c
> index cc3707b..5d2c45b 100644
> --- a/meta/recipes-devtools/makedevs/makedevs-1.0.0/makedevs.c
> +++ b/meta/recipes-devtools/makedevs/makedevs-1.0.0/makedevs.c
> @@ -465,8 +465,8 @@ int main(int argc, char **argv)
>                                 error_msg_and_die("%s: not a proper device
> table file", optarg);
>                         break;
>                 case 'h':
> -                       fprintf(stderr, helptext);
> -                       exit(1);
> +                       printf(helptext);
> +                       exit(0);
>                 case 'r':
>                 case 'd':                               /* for
> compatibility with mkfs.jffs, genext2fs, etc... */
>                         if (rootdir != default_rootdir) {
> @@ -476,8 +476,11 @@ int main(int argc, char **argv)
>                         break;
>
>                 case 'v':
> -                       fprintf(stderr, "makedevs revision %.*s\n",
> +                       printf("makedevs revision %.*s\n",
>                                         (int) strlen(revtext) - 13,
> revtext + 11);
> +                       exit(0);
> +               default:
> +                       fprintf(stderr, helptext);
>                         exit(1);
>                 }
>         }
> --
> 1.7.10.4
>
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org <javascript:;>
> http://lists.openembedded.org/mailman/listinfo/openembedded-core
>

[-- Attachment #2: Type: text/html, Size: 3410 bytes --]

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

* Re: [PATCH] makedevs: rectify the exit codes and handle the invalid parameter
  2013-09-25 14:27 ` Khem Raj
@ 2013-09-25 14:55   ` Richard Purdie
  2013-09-25 15:50     ` Khem Raj
  0 siblings, 1 reply; 4+ messages in thread
From: Richard Purdie @ 2013-09-25 14:55 UTC (permalink / raw)
  To: Khem Raj; +Cc: openembedded-core@lists.openembedded.org

On Wed, 2013-09-25 at 07:27 -0700, Khem Raj wrote:
> On Tuesday, September 24, 2013, wrote:
>         From: Roy Li <rongqing.li@windriver.com>
>         
>         It is correct behaviours to output help and version
>         information,
>         and should return 0;
>         When input parameter is invalid, print help information and
>         exit.

>
> This can cause gripes for systems who have scripted the old behavior
> And since it's a user visible change I would suggest to get it
> accepted upstream before 
> It's applied in openembedded 
> 
I think we have our own copy of this particular C file so we are the
upstream...

Cheers,

Richard




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

* Re: [PATCH] makedevs: rectify the exit codes and handle the invalid parameter
  2013-09-25 14:55   ` Richard Purdie
@ 2013-09-25 15:50     ` Khem Raj
  0 siblings, 0 replies; 4+ messages in thread
From: Khem Raj @ 2013-09-25 15:50 UTC (permalink / raw)
  To: Richard Purdie; +Cc: openembedded-core@lists.openembedded.org

[-- Attachment #1: Type: text/plain, Size: 1086 bytes --]

On Wednesday, September 25, 2013, Richard Purdie wrote:

> On Wed, 2013-09-25 at 07:27 -0700, Khem Raj wrote:
> > On Tuesday, September 24, 2013, wrote:
> >         From: Roy Li <rongqing.li@windriver.com <javascript:;>>
> >
> >         It is correct behaviours to output help and version
> >         information,
> >         and should return 0;
> >         When input parameter is invalid, print help information and
> >         exit.
>
> >
> > This can cause gripes for systems who have scripted the old behavior
> > And since it's a user visible change I would suggest to get it
> > accepted upstream before
> > It's applied in openembedded
> >
> I think we have our own copy of this particular C file so we are the
> upstream...


Likewise you can have copies of anything and call it upstream this file
also exists in busybox
And I would think there are people using that version too. If others are
syncing from this version
Then it's fine otherwise people migrating to oe will have yet another thing
to deal with.


> Cheers,
>
> Richard
>
>
>

[-- Attachment #2: Type: text/html, Size: 1597 bytes --]

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

end of thread, other threads:[~2013-09-25 15:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-25  5:58 [PATCH] makedevs: rectify the exit codes and handle the invalid parameter rongqing.li
2013-09-25 14:27 ` Khem Raj
2013-09-25 14:55   ` Richard Purdie
2013-09-25 15:50     ` Khem Raj

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