[Nix-dev] nix-store --verify --check-contents

Marc Weber marco-oweber at gmx.de
Sat May 8 22:20:37 CEST 2010


should not abort if it finds a socket:

  error: file
  `/nix/store/h0allyhzlxscrcjxrqif19ij48dpnwm3-avahi-0.6.25/var/run/avahi-daemon/socket'
  an unknown type

  I've had a filesystem corruption. Doing this check is vital to me.

  The throw Error line below causse the error.

  So would an alternative be putting some random bytes into the sink such
  as "type" "unkown" ?
  Does this make the check fail?
  Probably also a message should be printed.


  static void dump(const Path & path, Sink & sink, PathFilter & filter)
  {
      struct stat st;
      if (lstat(path.c_str(), &st))
          throw SysError(format("getting attributes of path `%1%'") % path);

      writeString("(", sink);

      if (S_ISREG(st.st_mode)) {
          writeString("type", sink);
          writeString("regular", sink);
          if (st.st_mode & S_IXUSR) {
              writeString("executable", sink);
              writeString("", sink);
          }
          dumpContents(path, (size_t) st.st_size, sink);
      } 

      else if (S_ISDIR(st.st_mode)) {
          writeString("type", sink);
          writeString("directory", sink);
          dumpEntries(path, sink, filter);
      }

      else if (S_ISLNK(st.st_mode)) {
          writeString("type", sink);
          writeString("symlink", sink);
          writeString("target", sink);
          writeString(readLink(path), sink);
      }

      else throw Error(format("file `%1%' has an unknown type") % path);

      writeString(")", sink);
  }


Marc Weber



More information about the nix-dev mailing list