Re: [Linuxptp-devel] [PATCH 1/4] ts2phc: Fix uninitialized variable in nmea_scan_rmc

2021-07-18 Thread Richard Cochran
On Fri, May 14, 2021 at 01:33:41PM +0200, Lars Munch wrote:
> tm_isdst needs to be initialized to make sure mktime does not fail
> on recent versions of glibc
> 
> See:
> https://bugzilla.redhat.com/show_bug.cgi?id=1653340
> https://sourceware.org/bugzilla/show_bug.cgi?id=24630
> 
> Signed-off-by: Lars Munch 

Applied.

Thanks,
Richard


___
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel


Re: [Linuxptp-devel] [PATCH 1/4] ts2phc: Fix uninitialized variable in nmea_scan_rmc

2021-05-14 Thread Lars Munch
I will just take your comment suggestion. I do not want to spend more
time on this.

On Fri, May 14, 2021 at 7:50 PM Geva, Erez  wrote:
>
> I think you can mention you are talking on UTC (Every one know UTC).
>
> May be something like:
> "As UTC do not use daylight savings time and with accords to POSIX, disable 
> the use of daylight savings by setting tm_isdst to 0".
>
> Feel free to find a better syntax.
>
> Or just copy the 2 lines from the POSIX (2004 Edition)
> https://pubs.opengroup.org/onlinepubs/009695399/functions/mktime.html
> "A positive or 0 value for tm_isdst shall cause mktime() to presume initially 
> that Daylight Savings Time, respectively, is or is not in effect for the 
> specified time.
>  A negative value for tm_isdst shall cause mktime() to attempt to determine 
> whether Daylight Savings Time is in effect for the specified time."
>
> Are you sure it was added in POSIX 2017?
> I do not think you need to be that precise which version of POSIX you use, 
> they usually do not change much. Only enhance functionality or improve 
> description.
>
> Last thought:
> We are software engineers, not poets. Do not be hard on yourself.
>
> Just use something short, clear that describe the problem and the fix.
> A message that if you read it in 2 years from now, you understand what was it.
>
> Erez
>
> -Original Message-
> From: Lars Munch 
> Sent: Friday, 14 May 2021 19:30
> To: Geva, Erez (ext) (DI PA DCP R 3) 
> Cc: linuxptp-devel@lists.sourceforge.net
> Subject: Re: [Linuxptp-devel] [PATCH 1/4] ts2phc: Fix uninitialized variable 
> in nmea_scan_rmc
>
> So how about the following simple explanation?
>
> According to POSIX.1-2017 tm_isdst must be set to 0 to indicate that Daylight 
> Savings Time is not in effect for the specified time.
>
>
>
> On Fri, May 14, 2021 at 6:28 PM Geva, Erez  wrote:
> >
> > One of my hardest bug was one a single bit.
> > Do not measure bugs by code. Measure by complexity.
> >
> > Erez
> >
> > -Original Message-----
> > From: Lars Munch 
> > Sent: Friday, 14 May 2021 18:14
> > To: Geva, Erez (ext) (DI PA DCP R 3) 
> > Cc: linuxptp-devel@lists.sourceforge.net
> > Subject: Re: [Linuxptp-devel] [PATCH 1/4] ts2phc: Fix uninitialized
> > variable in nmea_scan_rmc
> >
> > So much work for a one-liner. I see If I can come up with a better 
> > explanation.
> >
> > On Fri, May 14, 2021 at 4:34 PM Geva, Erez  
> > wrote:
> > >
> > > Hi,
> > >
> > >
> > >
> > > I think it is better to use a short explanation how does mktime() use the 
> > > tm_isdst flag, and why should it be set to 0.
> > >
> > > For me the problem is that we did not comply with proper use of mktime().
> > >
> > > Fixing glibc only revealed the bug in linuxptp.
> > >
> > > So we fix linuxptp, not trying to comply with a specific glibc!
> > >
> > >
> > >
> > > The choice of libc is up to the user, as long as it comply to the 
> > > standards (ISO C or POSIX).
> > >
> > > I do not see the purpose of links to bugs in glibc.
> > >
> > > It is also does not helps the Developers to understand, why do we need 
> > > the patch (which we do need).
> > >
> > >
> > >
> > > We are a source project, not a binary one
> > >
> > >
> > >
> > > Erez
> > >
> > >
> > >
> > > -Original Message-
> > > From: Lars Munch 
> > > Sent: Friday, 14 May 2021 13:34
> > > To: linuxptp-devel@lists.sourceforge.net
> > > Subject: [Linuxptp-devel] [PATCH 1/4] ts2phc: Fix uninitialized
> > > variable in nmea_scan_rmc
> > >
> > >
> > >
> > > tm_isdst needs to be initialized to make sure mktime does not fail
> > > on recent versions of glibc
> > >
> > >
> > >
> > > See:
> > >
> > > https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbu
> > > gzilla.redhat.com%2Fshow_bug.cgi%3Fid%3D1653340data=04%7C01%7Ce
> > > rez.geva.ext%40siemens.com%7C9d2a2f4353c0403194bc08d916fdfdd6%7C38ae
> > > 3bcd95794fd4addab42e1495d55a%7C1%7C0%7C637566103157490221%7CUnknown%
> > > 7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLC
> > > JXVCI6Mn0%3D%7C3000sdata=BkgCRqVecfkCb4ug8zYUpNz%2By6Lum%2FIm4y
> > > ZiZj8Hsw4%3Dreserved=0
> > >
> > > https://eur01.safelinks.protection.outlook.com/?url=http

Re: [Linuxptp-devel] [PATCH 1/4] ts2phc: Fix uninitialized variable in nmea_scan_rmc

2021-05-14 Thread Geva, Erez
I think you can mention you are talking on UTC (Every one know UTC).

May be something like: 
"As UTC do not use daylight savings time and with accords to POSIX, disable the 
use of daylight savings by setting tm_isdst to 0".

Feel free to find a better syntax.

Or just copy the 2 lines from the POSIX (2004 Edition)
https://pubs.opengroup.org/onlinepubs/009695399/functions/mktime.html
"A positive or 0 value for tm_isdst shall cause mktime() to presume initially 
that Daylight Savings Time, respectively, is or is not in effect for the 
specified time.
 A negative value for tm_isdst shall cause mktime() to attempt to determine 
whether Daylight Savings Time is in effect for the specified time."

Are you sure it was added in POSIX 2017?
I do not think you need to be that precise which version of POSIX you use, they 
usually do not change much. Only enhance functionality or improve description.

Last thought:
We are software engineers, not poets. Do not be hard on yourself.

Just use something short, clear that describe the problem and the fix.
A message that if you read it in 2 years from now, you understand what was it.

Erez

-Original Message-
From: Lars Munch  
Sent: Friday, 14 May 2021 19:30
To: Geva, Erez (ext) (DI PA DCP R 3) 
Cc: linuxptp-devel@lists.sourceforge.net
Subject: Re: [Linuxptp-devel] [PATCH 1/4] ts2phc: Fix uninitialized variable in 
nmea_scan_rmc

So how about the following simple explanation?

According to POSIX.1-2017 tm_isdst must be set to 0 to indicate that Daylight 
Savings Time is not in effect for the specified time.



On Fri, May 14, 2021 at 6:28 PM Geva, Erez  wrote:
>
> One of my hardest bug was one a single bit.
> Do not measure bugs by code. Measure by complexity.
>
> Erez
>
> -Original Message-
> From: Lars Munch 
> Sent: Friday, 14 May 2021 18:14
> To: Geva, Erez (ext) (DI PA DCP R 3) 
> Cc: linuxptp-devel@lists.sourceforge.net
> Subject: Re: [Linuxptp-devel] [PATCH 1/4] ts2phc: Fix uninitialized 
> variable in nmea_scan_rmc
>
> So much work for a one-liner. I see If I can come up with a better 
> explanation.
>
> On Fri, May 14, 2021 at 4:34 PM Geva, Erez  wrote:
> >
> > Hi,
> >
> >
> >
> > I think it is better to use a short explanation how does mktime() use the 
> > tm_isdst flag, and why should it be set to 0.
> >
> > For me the problem is that we did not comply with proper use of mktime().
> >
> > Fixing glibc only revealed the bug in linuxptp.
> >
> > So we fix linuxptp, not trying to comply with a specific glibc!
> >
> >
> >
> > The choice of libc is up to the user, as long as it comply to the standards 
> > (ISO C or POSIX).
> >
> > I do not see the purpose of links to bugs in glibc.
> >
> > It is also does not helps the Developers to understand, why do we need the 
> > patch (which we do need).
> >
> >
> >
> > We are a source project, not a binary one
> >
> >
> >
> > Erez
> >
> >
> >
> > -Original Message-
> > From: Lars Munch 
> > Sent: Friday, 14 May 2021 13:34
> > To: linuxptp-devel@lists.sourceforge.net
> > Subject: [Linuxptp-devel] [PATCH 1/4] ts2phc: Fix uninitialized 
> > variable in nmea_scan_rmc
> >
> >
> >
> > tm_isdst needs to be initialized to make sure mktime does not fail 
> > on recent versions of glibc
> >
> >
> >
> > See:
> >
> > https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbu
> > gzilla.redhat.com%2Fshow_bug.cgi%3Fid%3D1653340data=04%7C01%7Ce
> > rez.geva.ext%40siemens.com%7C9d2a2f4353c0403194bc08d916fdfdd6%7C38ae
> > 3bcd95794fd4addab42e1495d55a%7C1%7C0%7C637566103157490221%7CUnknown%
> > 7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLC
> > JXVCI6Mn0%3D%7C3000sdata=BkgCRqVecfkCb4ug8zYUpNz%2By6Lum%2FIm4y
> > ZiZj8Hsw4%3Dreserved=0
> >
> > https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fso
> > urceware.org%2Fbugzilla%2Fshow_bug.cgi%3Fid%3D24630data=04%7C01
> > %7Cerez.geva.ext%40siemens.com%7C9d2a2f4353c0403194bc08d916fdfdd6%7C
> > 38ae3bcd95794fd4addab42e1495d55a%7C1%7C0%7C637566103157500214%7CUnkn
> > own%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haW
> > wiLCJXVCI6Mn0%3D%7C3000sdata=%2FFscYQHQqnvekRr%2Fkmf2H4FL96HsT2
> > EbDqEF%2F2f1qHw%3Dreserved=0
> >
> >
> >
> > Signed-off-by: Lars Munch 
> >
> > ---
> >
> > nmea.c | 1 +
> >
> > 1 file changed, 1 insertion(+)
> >
> >
> >
> > diff --git a/nmea.c b/nmea.c
> >
> > index dc865d0..44c7c01 100644
> >
> > --- a/nmea.c
> >
>

Re: [Linuxptp-devel] [PATCH 1/4] ts2phc: Fix uninitialized variable in nmea_scan_rmc

2021-05-14 Thread Lars Munch
So how about the following simple explanation?

According to POSIX.1-2017 tm_isdst must be set to 0 to indicate that
Daylight Savings Time
is not in effect for the specified time.



On Fri, May 14, 2021 at 6:28 PM Geva, Erez  wrote:
>
> One of my hardest bug was one a single bit.
> Do not measure bugs by code. Measure by complexity.
>
> Erez
>
> -Original Message-
> From: Lars Munch 
> Sent: Friday, 14 May 2021 18:14
> To: Geva, Erez (ext) (DI PA DCP R 3) 
> Cc: linuxptp-devel@lists.sourceforge.net
> Subject: Re: [Linuxptp-devel] [PATCH 1/4] ts2phc: Fix uninitialized variable 
> in nmea_scan_rmc
>
> So much work for a one-liner. I see If I can come up with a better 
> explanation.
>
> On Fri, May 14, 2021 at 4:34 PM Geva, Erez  wrote:
> >
> > Hi,
> >
> >
> >
> > I think it is better to use a short explanation how does mktime() use the 
> > tm_isdst flag, and why should it be set to 0.
> >
> > For me the problem is that we did not comply with proper use of mktime().
> >
> > Fixing glibc only revealed the bug in linuxptp.
> >
> > So we fix linuxptp, not trying to comply with a specific glibc!
> >
> >
> >
> > The choice of libc is up to the user, as long as it comply to the standards 
> > (ISO C or POSIX).
> >
> > I do not see the purpose of links to bugs in glibc.
> >
> > It is also does not helps the Developers to understand, why do we need the 
> > patch (which we do need).
> >
> >
> >
> > We are a source project, not a binary one
> >
> >
> >
> > Erez
> >
> >
> >
> > -Original Message-
> > From: Lars Munch 
> > Sent: Friday, 14 May 2021 13:34
> > To: linuxptp-devel@lists.sourceforge.net
> > Subject: [Linuxptp-devel] [PATCH 1/4] ts2phc: Fix uninitialized variable in 
> > nmea_scan_rmc
> >
> >
> >
> > tm_isdst needs to be initialized to make sure mktime does not fail on 
> > recent versions of glibc
> >
> >
> >
> > See:
> >
> > https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugzilla.redhat.com%2Fshow_bug.cgi%3Fid%3D1653340data=04%7C01%7Cerez.geva.ext%40siemens.com%7Cbb3c26d6fe6243c5653c08d916f35332%7C38ae3bcd95794fd4addab42e1495d55a%7C1%7C0%7C637566057003345547%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000sdata=%2BiIYzGcoTO%2FoSXwswIGKV%2B%2F1%2B%2FJ%2FTeNy0YmbS5vFMAo%3Dreserved=0
> >
> > https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fsourceware.org%2Fbugzilla%2Fshow_bug.cgi%3Fid%3D24630data=04%7C01%7Cerez.geva.ext%40siemens.com%7Cbb3c26d6fe6243c5653c08d916f35332%7C38ae3bcd95794fd4addab42e1495d55a%7C1%7C0%7C637566057003345547%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000sdata=Z6FYtLeYtUpCZ%2B5zuv%2FBA8gLjTCns%2FtIU30UnYcytmE%3Dreserved=0
> >
> >
> >
> > Signed-off-by: Lars Munch 
> >
> > ---
> >
> > nmea.c | 1 +
> >
> > 1 file changed, 1 insertion(+)
> >
> >
> >
> > diff --git a/nmea.c b/nmea.c
> >
> > index dc865d0..44c7c01 100644
> >
> > --- a/nmea.c
> >
> > +++ b/nmea.c
> >
> > @@ -157,6 +157,7 @@ static int nmea_scan_rmc(struct nmea_parser *np, struct 
> > nmea_rmc *result)
> >
> >}
> >
> >tm.tm_year += 100;
> >
> >tm.tm_mon--;
> >
> > + tm.tm_isdst = 0;
> >
> >result->ts.tv_sec = mktime();
> >
> >result->ts.tv_nsec = msec * 100UL;
> >
> >result->fix_valid = status == 'A' ? true : false;
> >
> > --
> >
> > 2.25.1
> >
> >
> >
> >
> >
> >
> >
> > ___
> >
> > Linuxptp-devel mailing list
> >
> > Linuxptp-devel@lists.sourceforge.net
> >
> > https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.sourceforge.net%2Flists%2Flistinfo%2Flinuxptp-develdata=04%7C01%7Cerez.geva.ext%40siemens.com%7Cbb3c26d6fe6243c5653c08d916f35332%7C38ae3bcd95794fd4addab42e1495d55a%7C1%7C0%7C637566057003345547%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000sdata=W%2FcRIT%2FxVV%2BoClCJ%2Fpw1nOZFAwfC0rCsMu9oJra3O9g%3Dreserved=0


___
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel


Re: [Linuxptp-devel] [PATCH 1/4] ts2phc: Fix uninitialized variable in nmea_scan_rmc

2021-05-14 Thread Geva, Erez
One of my hardest bug was one a single bit.
Do not measure bugs by code. Measure by complexity.

Erez

-Original Message-
From: Lars Munch  
Sent: Friday, 14 May 2021 18:14
To: Geva, Erez (ext) (DI PA DCP R 3) 
Cc: linuxptp-devel@lists.sourceforge.net
Subject: Re: [Linuxptp-devel] [PATCH 1/4] ts2phc: Fix uninitialized variable in 
nmea_scan_rmc

So much work for a one-liner. I see If I can come up with a better explanation.

On Fri, May 14, 2021 at 4:34 PM Geva, Erez  wrote:
>
> Hi,
>
>
>
> I think it is better to use a short explanation how does mktime() use the 
> tm_isdst flag, and why should it be set to 0.
>
> For me the problem is that we did not comply with proper use of mktime().
>
> Fixing glibc only revealed the bug in linuxptp.
>
> So we fix linuxptp, not trying to comply with a specific glibc!
>
>
>
> The choice of libc is up to the user, as long as it comply to the standards 
> (ISO C or POSIX).
>
> I do not see the purpose of links to bugs in glibc.
>
> It is also does not helps the Developers to understand, why do we need the 
> patch (which we do need).
>
>
>
> We are a source project, not a binary one
>
>
>
> Erez
>
>
>
> -Original Message-
> From: Lars Munch 
> Sent: Friday, 14 May 2021 13:34
> To: linuxptp-devel@lists.sourceforge.net
> Subject: [Linuxptp-devel] [PATCH 1/4] ts2phc: Fix uninitialized variable in 
> nmea_scan_rmc
>
>
>
> tm_isdst needs to be initialized to make sure mktime does not fail on recent 
> versions of glibc
>
>
>
> See:
>
> https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugzilla.redhat.com%2Fshow_bug.cgi%3Fid%3D1653340data=04%7C01%7Cerez.geva.ext%40siemens.com%7Cbb3c26d6fe6243c5653c08d916f35332%7C38ae3bcd95794fd4addab42e1495d55a%7C1%7C0%7C637566057003345547%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000sdata=%2BiIYzGcoTO%2FoSXwswIGKV%2B%2F1%2B%2FJ%2FTeNy0YmbS5vFMAo%3Dreserved=0
>
> https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fsourceware.org%2Fbugzilla%2Fshow_bug.cgi%3Fid%3D24630data=04%7C01%7Cerez.geva.ext%40siemens.com%7Cbb3c26d6fe6243c5653c08d916f35332%7C38ae3bcd95794fd4addab42e1495d55a%7C1%7C0%7C637566057003345547%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000sdata=Z6FYtLeYtUpCZ%2B5zuv%2FBA8gLjTCns%2FtIU30UnYcytmE%3Dreserved=0
>
>
>
> Signed-off-by: Lars Munch 
>
> ---
>
> nmea.c | 1 +
>
> 1 file changed, 1 insertion(+)
>
>
>
> diff --git a/nmea.c b/nmea.c
>
> index dc865d0..44c7c01 100644
>
> --- a/nmea.c
>
> +++ b/nmea.c
>
> @@ -157,6 +157,7 @@ static int nmea_scan_rmc(struct nmea_parser *np, struct 
> nmea_rmc *result)
>
>}
>
>tm.tm_year += 100;
>
>tm.tm_mon--;
>
> + tm.tm_isdst = 0;
>
>result->ts.tv_sec = mktime();
>
>result->ts.tv_nsec = msec * 100UL;
>
>result->fix_valid = status == 'A' ? true : false;
>
> --
>
> 2.25.1
>
>
>
>
>
>
>
> ___
>
> Linuxptp-devel mailing list
>
> Linuxptp-devel@lists.sourceforge.net
>
> https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.sourceforge.net%2Flists%2Flistinfo%2Flinuxptp-develdata=04%7C01%7Cerez.geva.ext%40siemens.com%7Cbb3c26d6fe6243c5653c08d916f35332%7C38ae3bcd95794fd4addab42e1495d55a%7C1%7C0%7C637566057003345547%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000sdata=W%2FcRIT%2FxVV%2BoClCJ%2Fpw1nOZFAwfC0rCsMu9oJra3O9g%3Dreserved=0


___
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel


Re: [Linuxptp-devel] [PATCH 1/4] ts2phc: Fix uninitialized variable in nmea_scan_rmc

2021-05-14 Thread Lars Munch
So much work for a one-liner. I see If I can come up with a better explanation.

On Fri, May 14, 2021 at 4:34 PM Geva, Erez  wrote:
>
> Hi,
>
>
>
> I think it is better to use a short explanation how does mktime() use the 
> tm_isdst flag, and why should it be set to 0.
>
> For me the problem is that we did not comply with proper use of mktime().
>
> Fixing glibc only revealed the bug in linuxptp.
>
> So we fix linuxptp, not trying to comply with a specific glibc!
>
>
>
> The choice of libc is up to the user, as long as it comply to the standards 
> (ISO C or POSIX).
>
> I do not see the purpose of links to bugs in glibc.
>
> It is also does not helps the Developers to understand, why do we need the 
> patch (which we do need).
>
>
>
> We are a source project, not a binary one
>
>
>
> Erez
>
>
>
> -Original Message-
> From: Lars Munch 
> Sent: Friday, 14 May 2021 13:34
> To: linuxptp-devel@lists.sourceforge.net
> Subject: [Linuxptp-devel] [PATCH 1/4] ts2phc: Fix uninitialized variable in 
> nmea_scan_rmc
>
>
>
> tm_isdst needs to be initialized to make sure mktime does not fail on recent 
> versions of glibc
>
>
>
> See:
>
> https://bugzilla.redhat.com/show_bug.cgi?id=1653340
>
> https://sourceware.org/bugzilla/show_bug.cgi?id=24630
>
>
>
> Signed-off-by: Lars Munch 
>
> ---
>
> nmea.c | 1 +
>
> 1 file changed, 1 insertion(+)
>
>
>
> diff --git a/nmea.c b/nmea.c
>
> index dc865d0..44c7c01 100644
>
> --- a/nmea.c
>
> +++ b/nmea.c
>
> @@ -157,6 +157,7 @@ static int nmea_scan_rmc(struct nmea_parser *np, struct 
> nmea_rmc *result)
>
>}
>
>tm.tm_year += 100;
>
>tm.tm_mon--;
>
> + tm.tm_isdst = 0;
>
>result->ts.tv_sec = mktime();
>
>result->ts.tv_nsec = msec * 100UL;
>
>result->fix_valid = status == 'A' ? true : false;
>
> --
>
> 2.25.1
>
>
>
>
>
>
>
> ___
>
> Linuxptp-devel mailing list
>
> Linuxptp-devel@lists.sourceforge.net
>
> https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.sourceforge.net%2Flists%2Flistinfo%2Flinuxptp-develdata=04%7C01%7Cerez.geva.ext%40siemens.com%7C6bd447d3aa4a436be41808d916d024c9%7C38ae3bcd95794fd4addab42e1495d55a%7C1%7C0%7C637565905494246406%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000sdata=JgJVYnL%2BvSHUfF5H9n%2FZC0N0dwSr%2Fw2flJ5QGdZ88lI%3Dreserved=0


___
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel


Re: [Linuxptp-devel] [PATCH 1/4] ts2phc: Fix uninitialized variable in nmea_scan_rmc

2021-05-14 Thread Geva, Erez
Hi,



I think it is better to use a short explanation how does mktime() use the 
tm_isdst flag, and why should it be set to 0.

For me the problem is that we did not comply with proper use of mktime().

Fixing glibc only revealed the bug in linuxptp.

So we fix linuxptp, not trying to comply with a specific glibc!



The choice of libc is up to the user, as long as it comply to the standards 
(ISO C or POSIX).

I do not see the purpose of links to bugs in glibc.

It is also does not helps the Developers to understand, why do we need the 
patch (which we do need).



We are a source project, not a binary one 



Erez



-Original Message-
From: Lars Munch 
Sent: Friday, 14 May 2021 13:34
To: linuxptp-devel@lists.sourceforge.net
Subject: [Linuxptp-devel] [PATCH 1/4] ts2phc: Fix uninitialized variable in 
nmea_scan_rmc



tm_isdst needs to be initialized to make sure mktime does not fail on recent 
versions of glibc



See:

https://bugzilla.redhat.com/show_bug.cgi?id=1653340

https://sourceware.org/bugzilla/show_bug.cgi?id=24630



Signed-off-by: Lars Munch mailto:l...@segv.dk>>

---

nmea.c | 1 +

1 file changed, 1 insertion(+)



diff --git a/nmea.c b/nmea.c

index dc865d0..44c7c01 100644

--- a/nmea.c

+++ b/nmea.c

@@ -157,6 +157,7 @@ static int nmea_scan_rmc(struct nmea_parser *np, struct 
nmea_rmc *result)

   }

   tm.tm_year += 100;

   tm.tm_mon--;

+ tm.tm_isdst = 0;

   result->ts.tv_sec = mktime();

   result->ts.tv_nsec = msec * 100UL;

   result->fix_valid = status == 'A' ? true : false;

--

2.25.1







___

Linuxptp-devel mailing list

Linuxptp-devel@lists.sourceforge.net

https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.sourceforge.net%2Flists%2Flistinfo%2Flinuxptp-develdata=04%7C01%7Cerez.geva.ext%40siemens.com%7C6bd447d3aa4a436be41808d916d024c9%7C38ae3bcd95794fd4addab42e1495d55a%7C1%7C0%7C637565905494246406%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000sdata=JgJVYnL%2BvSHUfF5H9n%2FZC0N0dwSr%2Fw2flJ5QGdZ88lI%3Dreserved=0
___
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel