[Debian-astro-maintainers] Bug#1077881: wcstools-3.9.7 crlf change

Ole Streicher olebole at debian.org
Mon Aug 5 11:17:46 BST 2024


Control: tags -1 wontfix

Hi Sergey,

On 04.08.24 01:05, Сергей Фёдоров wrote:
> In the package "wcstools-3.9.7" the program "crlf" changes the symbol 0Dh to 0Ah.
> As a result, an empty string appears instead of each 0Dh.

 From looking at the source code, I can't see this. The original code 
just replaces each 0D with a 0A, as it is supposed to do. This does not 
introduce an empty string here.

Note that the program does *not* do a "dos-to-unix" conversion, i.e. it 
does not change CR+LF into single LF, and it is not documented that it 
should do it.

The real purpose of the crlf program is unclear to me; it is included 
here because it is part of upstream's source code. If you think that 
this is a wcstools bug, please discuss it with upstream. I would rather 
just remove the crlf tool if it confuses people.

Best

Ole

> 
> -- System Information:
> Debian Release: 12.6
>    APT prefers stable
>    APT policy: (500, 'stable')
> Architecture: amd64 (x86_64)
> 
> Kernel: Linux 6.1.0-22-amd64 (SMP w/8 CPU threads; PREEMPT)
> Locale: LANG=ru_RU.UTF-8, LC_CTYPE=ru_RU.UTF-8 (charmap=UTF-8), LANGUAGE not set
> Shell: /bin/sh linked to /usr/bin/dash
> Init: systemd (via /run/systemd/system)
> LSM: AppArmor: enabled
> 
> Versions of packages wcstools depends on:
> ii  libc6         2.36-9+deb12u7
> ii  libwcstools1  3.9.7-1
> 
> wcstools recommends no packages.
> 
> wcstools suggests no packages.
> 
> -- no debconf information
> 
>     Copyright (C) 2006
>     Smithsonian Astrophysical Observatory, Cambridge, MA USA
> 
>     This program is free software; you can redistribute it and/or
>     modify it under the terms of the GNU General Public License
>     as published by the Free Software Foundation; either version 2
>     of the License, or (at your option) any later version.
> 
>     This program is distributed in the hope that it will be useful,
>     but WITHOUT ANY WARRANTY; without even the implied warranty of
>     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
>     GNU General Public License for more details.
> 
>     You should have received a copy of the GNU General Public License
>     along with this program; if not, write to the Free Software Foundation,
>     Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
>   */
> 
> #include <stdio.h>
> #include <stdlib.h>
> #include <string.h>
> #include <unistd.h>
> #include <fcntl.h>
> 
> static int verbose = 0;         /* verbose/debugging flag */
> static void usage();
> static void CRFix();
> 
> int
> main (ac, av)
> int ac;
> char **av;
> {
>      char *fn;
>      char *str;
> 
>      /* crack arguments */
>      for (av++; --ac > 0 && *(str = *av) == '-'; av++) {
>          char c;
>          while ((c = *++str))
>          switch (c) {
> 
>          case 'v':       /* more verbosity */
>              verbose++;
>              break;
> 
>          default:
>              usage();
>              break;
>          }
>      }
> 
>      /* There are ac remaining file names starting at av[0] */
>      if (ac == 0)
>          usage ();
> 
>      while (ac-- > 0) {
>          fn = *av++;
>          if (verbose)
>              printf ("%s:\n", fn);
>              CRFix (fn);
>          if (verbose)
>              printf ("\n");
>      }
> 
>      return (0);
> }
> 
> static void
> usage ()
> {
>      fprintf (stderr,"CRLF: Change carriage returns to linefeeds in a file\n");
>      fprintf(stderr,"Usage:  crlf [-v] file1 file2 ... filen\n");
>      fprintf(stderr,"  -v: verbose\n");
>      exit (1);
> }
> 
> static void
> CRFix (name)
> 
> char *name;
> 
> {
>      char buffer[1000];
>      char buffer2[1000];  // 2024-07-28 16:31
>      int fd;
>      int nbr, i;
>      int nbr2;  // 2024-07-28 16:31
> 
>      fd = open (name, O_RDONLY);
>      nbr = 1000;
>      while (nbr > 0) {
>          nbr = read (fd, buffer, 1000);
>          nbr2 = 0;  // 2024-07-28 16:31
>          if (nbr > 0) {
>              for (i = 0; i < nbr; i++) {
>                  /*   // 2024-07-28 16:31 comment because an empty string is created
>                  if (buffer[i] == (char) 13)
>                  // buffer[i] = (char) 10;
>                  */
>                  if (buffer[i] != (char) 13) {  // 2024-07-28 16:31 insert block
>                      buffer2[nbr2] = buffer[i];
>                      nbr2++;
>                  }
>              }
>              // (void) write (1, buffer, nbr); // 2024-07-28 16:31 comment
>              (void) write (1, buffer2, nbr2);  // 2024-07-28 16:31
>          }
>      }
>      return;
> }
> /* Feb 10 1998    New program
>   *
>   * Apr  3 2005    Declare main to be int
>   *
>   * Jun 20 2006    Clean up code
>   */
> 



More information about the Debian-astro-maintainers mailing list