All of lore.kernel.org
 help / color / mirror / Atom feed
* recent change in seqmid.c is broken?
@ 2025-04-14 15:44 Takashi Iwai
  2025-04-14 16:45 ` Jaroslav Kysela
  0 siblings, 1 reply; 4+ messages in thread
From: Takashi Iwai @ 2025-04-14 15:44 UTC (permalink / raw)
  To: perex; +Cc: alsa-devel

Hi Jaroslav,

I'm afraid that your recent fix for alsa-lib commit a4e47461eca1
doesn't work as expected:

```
@@ -664,15 +663,11 @@ static void update_group_ports(snd_seq_t *seq, snd_ump_endpoint_info_t *ep)
                                break;
                        }
 
-                       if (!*bp->name)
+                       if (bp->name[0] == '\0')
                                continue;
-                       len = strlen(blknames);
-                       if (len)
-                               snprintf(blknames + len, sizeof(blknames) - len,
-                                        ", %s", bp->name);
-                       else
-                               snd_strlcpy(blknames, (const char *)bp->name,
-                                           sizeof(blknames));
+                       if (blknames[0])
+                               snd_strlcpy(blknames, ", ", sizeof(blknames));
+                       snd_strlcpy(blknames, (const char *)bp->name, sizeof(blknames));
                }
 
                if (!*blknames)
```

The original code appended the new bp->name string with the prefix of
", " if blknames is already present, but the new code looks as if it
overwrites onto blknames with strlcpy() from scratch for each
bp->name.

FWIW, the code there used to be with strlcat(), but it was rewritten
in the way above because strlcat() isn't always available in commit
d9694398130c.


thanks,

Takashi

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

* Re: recent change in seqmid.c is broken?
  2025-04-14 15:44 recent change in seqmid.c is broken? Takashi Iwai
@ 2025-04-14 16:45 ` Jaroslav Kysela
  2025-04-14 17:13   ` Jaroslav Kysela
  2025-04-15  5:39   ` Takashi Iwai
  0 siblings, 2 replies; 4+ messages in thread
From: Jaroslav Kysela @ 2025-04-14 16:45 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: alsa-devel

On 14. 04. 25 17:44, Takashi Iwai wrote:
> Hi Jaroslav,
> 
> I'm afraid that your recent fix for alsa-lib commit a4e47461eca1
> doesn't work as expected:
> 
> ```
> @@ -664,15 +663,11 @@ static void update_group_ports(snd_seq_t *seq, snd_ump_endpoint_info_t *ep)
>                                  break;
>                          }
>   
> -                       if (!*bp->name)
> +                       if (bp->name[0] == '\0')
>                                  continue;
> -                       len = strlen(blknames);
> -                       if (len)
> -                               snprintf(blknames + len, sizeof(blknames) - len,
> -                                        ", %s", bp->name);
> -                       else
> -                               snd_strlcpy(blknames, (const char *)bp->name,
> -                                           sizeof(blknames));
> +                       if (blknames[0])
> +                               snd_strlcpy(blknames, ", ", sizeof(blknames));
> +                       snd_strlcpy(blknames, (const char *)bp->name, sizeof(blknames));
>                  }
>   
>                  if (!*blknames)
> ```
> 
> The original code appended the new bp->name string with the prefix of
> ", " if blknames is already present, but the new code looks as if it
> overwrites onto blknames with strlcpy() from scratch for each
> bp->name.
> 
> FWIW, the code there used to be with strlcat(), but it was rewritten
> in the way above because strlcat() isn't always available in commit
> d9694398130c.

Oops.... I am at the end of 1.2.14 release procedure.

I'm trying to put the correct fix, could you check quickly latest two commits?

		Thanks,
				Jaroslav


-- 
Jaroslav Kysela <perex@perex.cz>
Linux Sound Maintainer; ALSA Project; Red Hat, Inc.

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

* Re: recent change in seqmid.c is broken?
  2025-04-14 16:45 ` Jaroslav Kysela
@ 2025-04-14 17:13   ` Jaroslav Kysela
  2025-04-15  5:39   ` Takashi Iwai
  1 sibling, 0 replies; 4+ messages in thread
From: Jaroslav Kysela @ 2025-04-14 17:13 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: alsa-devel

On 14. 04. 25 18:45, Jaroslav Kysela wrote:
> On 14. 04. 25 17:44, Takashi Iwai wrote:
>> Hi Jaroslav,
>>
>> I'm afraid that your recent fix for alsa-lib commit a4e47461eca1
>> doesn't work as expected:
>>
>> ```
>> @@ -664,15 +663,11 @@ static void update_group_ports(snd_seq_t *seq, snd_ump_endpoint_info_t *ep)
>>                                   break;
>>                           }
>>    
>> -                       if (!*bp->name)
>> +                       if (bp->name[0] == '\0')
>>                                   continue;
>> -                       len = strlen(blknames);
>> -                       if (len)
>> -                               snprintf(blknames + len, sizeof(blknames) - len,
>> -                                        ", %s", bp->name);
>> -                       else
>> -                               snd_strlcpy(blknames, (const char *)bp->name,
>> -                                           sizeof(blknames));
>> +                       if (blknames[0])
>> +                               snd_strlcpy(blknames, ", ", sizeof(blknames));
>> +                       snd_strlcpy(blknames, (const char *)bp->name, sizeof(blknames));
>>                   }
>>    
>>                   if (!*blknames)
>> ```
>>
>> The original code appended the new bp->name string with the prefix of
>> ", " if blknames is already present, but the new code looks as if it
>> overwrites onto blknames with strlcpy() from scratch for each
>> bp->name.
>>
>> FWIW, the code there used to be with strlcat(), but it was rewritten
>> in the way above because strlcat() isn't always available in commit
>> d9694398130c.
> 
> Oops.... I am at the end of 1.2.14 release procedure.
> 
> I'm trying to put the correct fix, could you check quickly latest two commits?

The fix is in 1.2.14 alsa-lib release.

				Jaroslav

-- 
Jaroslav Kysela <perex@perex.cz>
Linux Sound Maintainer; ALSA Project; Red Hat, Inc.

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

* Re: recent change in seqmid.c is broken?
  2025-04-14 16:45 ` Jaroslav Kysela
  2025-04-14 17:13   ` Jaroslav Kysela
@ 2025-04-15  5:39   ` Takashi Iwai
  1 sibling, 0 replies; 4+ messages in thread
From: Takashi Iwai @ 2025-04-15  5:39 UTC (permalink / raw)
  To: Jaroslav Kysela; +Cc: alsa-devel

On Mon, 14 Apr 2025 18:45:04 +0200,
Jaroslav Kysela wrote:
> 
> On 14. 04. 25 17:44, Takashi Iwai wrote:
> > Hi Jaroslav,
> > 
> > I'm afraid that your recent fix for alsa-lib commit a4e47461eca1
> > doesn't work as expected:
> > 
> > ```
> > @@ -664,15 +663,11 @@ static void update_group_ports(snd_seq_t *seq, snd_ump_endpoint_info_t *ep)
> >                                  break;
> >                          }
> >   -                       if (!*bp->name)
> > +                       if (bp->name[0] == '\0')
> >                                  continue;
> > -                       len = strlen(blknames);
> > -                       if (len)
> > -                               snprintf(blknames + len, sizeof(blknames) - len,
> > -                                        ", %s", bp->name);
> > -                       else
> > -                               snd_strlcpy(blknames, (const char *)bp->name,
> > -                                           sizeof(blknames));
> > +                       if (blknames[0])
> > +                               snd_strlcpy(blknames, ", ", sizeof(blknames));
> > +                       snd_strlcpy(blknames, (const char *)bp->name, sizeof(blknames));
> >                  }
> >                    if (!*blknames)
> > ```
> > 
> > The original code appended the new bp->name string with the prefix of
> > ", " if blknames is already present, but the new code looks as if it
> > overwrites onto blknames with strlcpy() from scratch for each
> > bp->name.
> > 
> > FWIW, the code there used to be with strlcat(), but it was rewritten
> > in the way above because strlcat() isn't always available in commit
> > d9694398130c.
> 
> Oops.... I am at the end of 1.2.14 release procedure.
> 
> I'm trying to put the correct fix, could you check quickly latest two commits?

Looks good to me.  Thanks!


Takashi

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

end of thread, other threads:[~2025-04-15  5:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-14 15:44 recent change in seqmid.c is broken? Takashi Iwai
2025-04-14 16:45 ` Jaroslav Kysela
2025-04-14 17:13   ` Jaroslav Kysela
2025-04-15  5:39   ` Takashi Iwai

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.