Bug in xbps-create when a relative symlink point to an absolute symlink
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 38/100
Línea de trabajo
Start by running the supplied reproduction script and inspect xbps-create's symlink handling around readlink and realpath. Compare the generated files.plist with the package contents, then verify that the corrected metadata lets xbps-remove remove both symlinks without truncating the target path.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Simple script to reproduce
#! /bin/sh
set -e
PKGVER=bug-1_1
ARCH=x86_64
DESC="Package to show a bug in xbps-create"
DESTDIR=/tmp/bug-1
mkdir -p $DESTDIR/etc/A
ln -s /etc/os-release $DESTDIR/etc/abs
ln -s ../abs $DESTDIR/etc/A/rel
xbps-create --arch "$ARCH" --desc "$DESC" --pkgver "$PKGVER" $DESTDIR
After running this script you'll end up with a badly formed package. Contents are ok:
$ tar tvf bug-1_1.x86_64.xbps
-rw-r--r-- root/root 503 1969-12-31 21:00 ./props.plist
-rw-r--r-- root/root 744 1969-12-31 21:00 ./files.plist
lrwxrwxrwx 0/0 0 2021-11-28 20:06 ./etc/abs -> /etc/os-release
lrwxrwxrwx 0/0 0 2021-11-28 20:06 ./etc/A/rel -> ../abs
But files.plist is wrong:
$ tar xOf bug-1_1.x86_64.xbps ./files.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>dirs</key>
<array>
<dict>
<key>file</key>
<string>/etc</string>
</dict>
<dict>
<key>file</key>
<string>/etc/A</string>
</dict>
</array>
<key>links</key>
<array>
<dict>
<key>file</key>
<string>/etc/A/rel</string>
<key>mtime</key>
<integer>1638140801</integer>
<key>target</key>
<string>lease</string>
</dict>
<dict>
<key>file</key>
<string>/etc/abs</string>
<key>mtime</key>
<integer>1638140801</integer>
<key>target</key>
<string>/etc/os-release</string>
</dict>
</array>
</dict>
</plist>
What is going on I think is:
- the file in destdir
/etc/A/relis a symlink andreadlinkgives../abswhich is understood to be relative since it starts with. - the filename is then canonicalized (using realpath) to
/etc/os-release - since the symlink was thought to be relative, this is expected to be inside destdir
- hence we drop the destdir prefix
/tmp/bug-1, that's 10 characters so/etc/os-releaseminus 10 characters giveslease
This actually bit us in the wip sagemath package. The net result is that those symlinks that are badly reported in files.plistare not removed by xbps-remove.
I've since made a workaround in the sagemath package so this won't affect us, but it'd be nice to fix this logic (whiich is kind of hard to understand), at the very least check that the prefix for the link is indeed the destdir before droping it naively and complain if not.
All of this is affected by whether the canonicalized path is actually an existing file; that's why I chose /etc/os-release which should always exist (if this file is not there, the bug doesn't trigger).
- Lenguaje dominante
- C
- Estrellas
- 1.2k
- Forks
- 152
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de void-linux/xbps
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 68/100
void-linux/xbps#475 ·
-
Dificultad 4/5 3-5 días Aptitud para principiantes 45/100
void-linux/xbps#701 ·
-
Dificultad 4/5 3-5 días Aptitud para principiantes 55/100
void-linux/xbps#700 ·
-
xbps-query -RX repository overridesPosiblemente ocupada @outofsyncrs la tomó hace 30 días. Abiertobug
Dificultad 3/5 1-2 días Aptitud para principiantes 45/100
void-linux/xbps#696 ·
-
Dificultad 3/5 1-2 días Aptitud para principiantes 52/100
void-linux/xbps#695 · 7 comentarios ·
Todos los issues de void-linux/xbps
Issues similares
-
chore(gateway): emit INFO budget reserved/settled logs for proactivity v2 (chip task_2855f4ec)Abiertobackend
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
BasedHardware/omi#20940 ·
Los mantenedores suelen responder en 1 día
-
Linux notifications: the default action's ' ' label shows as a blank button in xfce4-notifydAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
kovidgoyal/kitty#10625 ·
Los mantenedores suelen responder en 1 día
-
Feature Status: Needs Triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 73/100
Los mantenedores suelen responder en 1 día
-
docs
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día