On Dec 16, 2007 1:16 AM, Sasidhar Kasturi <[EMAIL PROTECTED]> wrote:
> Yes .. but have a look at the bug i am working on ..
> Bug id:6493125
>
> http://bugs.opensolaris.org/view_bug.do?bug_id=6493125
>
> Thank you,
>  Sasidhar.

I'm not sure what question you are asking...

1) Why are there two variants of df?

If this is the question, it is likely because Solaris already had df
that had some behavior that people had grown to depend on.  A
standards committee came along and said "We need the -P and -v option
and the formatting of these headers needs to be ... and these columns
needs to be like ...".  Sun needed to not disrupt existing customers
and needed XPG4 compliance to satisfy a potentially different set of
customers.  Thus, the XPG4 variant got some small changes that (at the
time?) weren't appropriate for the traditional version.

There is some likelihood that the bug you are working on is not the
first time that the differences between the XPG4 variant and the
/usr/bin variant have decreased.

2) How could the same source code produce different output?

It looks as though enabling the -P option is pretty straightforward -
modification of the getopts() string at removal of the #ifdef at line
593 and getting rid of the #ifdef and corresponding #endif at lines
605 and 607 should be sufficient.

    590 #ifdef XPG4
    591         while ((arg = getopt(argc, argv, "F:o:abehkVtgnlPZ")) != EOF) {
    592 #else
    593         while ((arg = getopt(argc, argv, "F:o:abehkVtgnlvZ")) != EOF) {
    594 #endif
    595                 if (arg == 'F') {
    596                         if (F_option)
    597                                 errmsg(ERR_FATAL + ERR_USAGE,
    598                                     "more than one FSType specified");
    599                         F_option = 1;
    600                         FSType = optarg;
    601                 } else if (arg == 'V' && ! V_option) {
    602                         V_option = TRUE;
    603                 } else if (arg == 'v' && ! v_option) {
    604                         v_option = TRUE;
    605 #ifdef XPG4
    606                 } else if (arg == 'P' && ! P_option) {
    607                         SET_OPTION(P);
    608 #endif

Of course, updating the usage error, man page, etc. would be
appropriate too.  You can see a few other "#ifdef XPG4" blocks that
show the quite small differences between the two variants.

Also... since there is nothing zfs-specific here, opensolaris-code may
be a more appropriate forum.

-- 
Mike Gerdts
http://mgerdts.blogspot.com/
_______________________________________________
zfs-discuss mailing list
zfs-discuss@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/zfs-discuss

Reply via email to