Re: [PATCH] Be nice to malformed lines in /etc/fstab (#517291)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Might be a good idea to truncate the malformed fstab lines
before creating the warning dialog to avoid having a really ugly warning
dialog.

Other than that, it looks good.

On Tue, Aug 18, 2009 at 09:44:21AM +0200, Martin Sivak wrote:
> ---
>  storage/__init__.py |   18 +++++++++++++++++-
>  1 files changed, 17 insertions(+), 1 deletions(-)
> 
> diff --git a/storage/__init__.py b/storage/__init__.py
> index 094c079..4da5459 100644
> --- a/storage/__init__.py
> +++ b/storage/__init__.py
> @@ -1080,6 +1080,14 @@ def mountExistingSystem(anaconda, rootEnt,
>                                  options=readOnly)
>  
>      fsset.parseFSTab(chroot=rootPath)
> +    if len(fsset.malformedLines)>0:
> +        messageWindow(_("Malformed /etc/fstab entries"),
> +                      _("The following entries in your "
> +                        "/etc/fstab were malformed. Should you want "
> +                        "to use or correct them, uncomment them "
> +                        "after reboot.\n"
> +                        "%s") % "\n".join(fsset.malformedLines))
> +
>  
>      # check for dirty filesystems
>      dirtyDevs = []
> @@ -1279,6 +1287,7 @@ class FSSet(object):
>          self._proc = None
>          self._devshm = None
>          self.preserveLines = []     # lines we just ignore and preserve
> +        self.malformedLines = []     # lines we just ignore and preserve
>  
>      @property
>      def sysfs(self):
> @@ -1484,7 +1493,9 @@ class FSSet(object):
>                      self.preserveLines.append(line)
>                      continue
>                  except Exception as e:
> -                    raise Exception("fstab entry %s is malformed: %s" % (devspec, e))
> +                    # malformed line - write it out as a comment
> +                    self.malformedLines.append(line)
> +                    continue
>  
>                  if not device:
>                      continue
> @@ -1896,4 +1907,9 @@ class FSSet(object):
>          for line in self.preserveLines:
>              fstab += line
>  
> +        # write any line that was present in the original fstab, but we
> +        # were unable to parse it, write it as comment
> +        for line in self.malformedLines:
> +            fstab += "# " + line
> +
>          return fstab
> -- 
> 1.6.4
> 
> _______________________________________________
> Anaconda-devel-list mailing list
> Anaconda-devel-list@xxxxxxxxxx
> https://www.redhat.com/mailman/listinfo/anaconda-devel-list

-- 
Joel Andres Granados
Brno, Czech Republic, Red Hat.

Attachment: pgpgIDCw0EvQN.pgp
Description: PGP signature

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux