Directorios Sin Propietario
El término “directorio desconocido” (o “directorio huérfano”) se refiere a una confusión donde suceden estas tres cosas:
-
un paquete incluye archivos con un directorio creado, pero no el mismo directorio
-
ninguna de las dependencias de paquete proporcionan el directorio en su caso
-
el directorio pertenece a su paquete y no pertenece a ningún paquete principal o paquete de sistema de archivos base que se considere esencial/fundamental para cualquier sistema Fedora.
Asuntos
Los directorios sin propietario pueden causar los siguientes problemas.
Directorios Inaccesibles
Una máscara (umask) de superusuario restrictiva durante la instalación de un paquete puede crear directorios inaccesibles al instalarse con el Administrador de Paquetes RPM anterior a la versión 4.4.2.3. Fedora 9 y RHEL 5.3 son los primeros en usar RPM 4.4.2.3, que siempre establece la máscara de superusuario en 0022. En plataformas con versiones anteriores de RPM, si el superusuario hace lo siguiente:
+ umask 077+ + + yum update+ + + ` + ` rpm -ivh PAQUETE+
Unowned directories within the updated or installed packages will only be readable and executable by root. This prevents other users from using the files within those directories.
This causes run-time problems for users. For example, unreadable subdirs below %_libdir disable plugins. Unreadable subdirs below %_datadir prevent application data, help texts, and graphics from being accessed.
Varias ordenaciones de usuarios solucionan problemas de permisos con chmod en vez de tomar el tiempo para informarlo como defecto. Es creencia común que tales errores son tan obvios que serían encontrados por el mantenedor del paquete o será comunicado por otros usuarios.
Directorios no Retirados
Upon uninstalling the package (or upgrading to another version), the old directory is not removed from the file system because it does not belong in the package in the RPM database.
Especially if directories contain a version number, they clutter up the file system with every update which doesn’t remove old directories.
Tools to Help
It’s easy to find unowned directories with rpmls from rpmdevtools or rpm -qlv. Just a bit of carefulness is needed to not include core filesystem directories, such as %_bindir, %_libdir (and obvious others, e.g. from the "filesystem" pkg) which don’t belong into your package.
Common Mistakes
Here are some examples of common packaging mistakes in spec %files lists to avoid
Wildcarding Files inside a Created Directory
Unversioned
%{_datadir}/foo/*
This includes everything in "foo", but not "foo" itself. "rpm -qlv pkgname" will show a missing drwxr-xr-x entry for "foo". Correct would be:
%{_datadir}/foo/
to include the directory and the entire tree below it.
Versión
%{_docdir}/%{name}-%{version}/*
%{_includedir}/%{name}-%{version}/*.h
This is the same as the unversioned scenario with the addition that every time the package is upgraded to a new version the old directory will remain on the filesystem. Correct would be:
%{_docdir}/%{name}-%{version}/
%dir %{_includedir}/%{name}-%{version}
%{_includedir}/%{name}-%{version}/*.h
Forgetting to Include a Toplevel Directory
%dir %{_libdir}/foo-2/fu
%dir %{_libdir}/foo-2/bar
%{_libdir}/foo-2/fu/*.so
%{_libdir}/foo-2/bar/config*
Here it is an attempt at including the directories explicitly with the %dir macro. However, while "bar" is included, "foo-2" is not. Typically packagers run into that mistake if all installed files are stored only in subdirs of the parent "foo-2" directory. Correct would be:
%dir %{_libdir}/foo-2
%dir %{_libdir}/foo-2/fu
%dir %{_libdir}/foo-2/bar
%{_libdir}/foo-2/fu/*.so
%{_libdir}/foo-2/bar/config*
Only Including Files
%{_datadir}/%{name}/db/raw/*.db
%{_datadir}/%{name}/pixmaps/*.png
Here only specific data files are included, and all 4 directories below %_datadir are unowned. Correct would be:
%dir %{_datadir}/%{name}
%dir %{_datadir}/%{name}/db
%dir %{_datadir}/%{name}/db/raw
%dir %{_datadir}/%{name}/pixmaps
%{_datadir}/%{name}/db/raw/*.db
%{_datadir}/%{name}/pixmaps/*.png
Want to help? Learn how to contribute to Fedora Docs ›