1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
|
.Dd September 27, 2026
.Dt REVDEP 8
.Os
.Sh NAME
.Nm revdep
.Nd find packages with broken shared library dependencies
.Sh SYNOPSIS
.Nm
.Op Fl v
.Op Fl i Ar package , Ns Ar ...
.Op Ar package ...
.Nm
.Op Fl v
.Op Fl i Ar package , Ns Ar ...
.Fl r
.Ar package ...
.Nm
.Fl h | V
.Sh DESCRIPTION
.Nm
checks installed packages for shared libraries that the dynamic linker
would not find.
Without a
.Ar package ,
every installed package is checked.
.Pp
The files of a package are read from the package database.
Each one that is an x86_64 executable or shared object is inspected:
every library in its
.Dv DT_NEEDED
entries must be found, as described in
.Sx LIBRARY SEARCH ,
and must itself be an x86_64 ELF file.
Other files, and ELF files for other architectures, are skipped.
A package is broken if one of its files needs a library that is not
found, or if it has files in the directory of an older Python or Perl;
see
.Sx STALE LANGUAGE PATHS .
.Pp
With
.Fl r ,
.Nm
reports the reverse: the packages that link against a shared library
of one of the named packages.
Run it after updating a library to see what may need rebuilding.
A shared library is a file named
.Pa name.so
or
.Pa name.so.\& Ns Ar N ... ;
a package depends on it if a
.Dv DT_NEEDED
entry of one of its files is that name.
.Pp
Options must come before the package names.
The options are as follows:
.Bl -tag -width Ds
.It Fl h
Print a usage summary.
.It Fl i Ar package , Ns Ar ...
Ignore the listed packages: they are not checked, and with
.Fl r
not reported.
May be given more than once.
.It Fl r
Reverse mode, as described above.
Needs at least one
.Ar package .
.It Fl V
Print the version.
.It Fl v
More output; may be given up to four times:
.Bl -tag -width "-vvvv"
.It none
The names of the broken packages, or with
.Fl r
of the dependent packages, one per line, for use in scripts.
.It Fl v
A status line for every package.
.It Fl vv
Also the broken files, or with
.Fl r
the files that need a library of the named packages.
.It Fl vvv
Also which library each broken file misses.
.It Fl vvvv
A trace of everything checked.
.El
.El
.Sh LIBRARY SEARCH
A library is looked for the way the musl dynamic linker does:
.Bl -enum
.It
A
.Dv DT_NEEDED
entry containing a
.Ql /
is taken as a path.
.It
The directories in
.Dv DT_RUNPATH ,
or in
.Dv DT_RPATH
if there is no
.Dv DT_RUNPATH .
.Li $ORIGIN
is replaced by the directory of the file being checked and
.Li $LIB
by
.Li lib .
.It
The system path: the directories in
.Pa /etc/ld-musl-x86_64.path ,
separated by
.Ql \&:
or new lines, if that file exists, otherwise
.Pa /lib ,
.Pa /usr/local/lib
and
.Pa /usr/lib .
.It
The directories listed for the package in
.Pa /etc/revdep.d/ ;
see
.Sx FILES .
.El
.Sh STALE LANGUAGE PATHS
Modules built for one Python or Perl version are installed in a
directory named after it, and are not found once another version is
installed.
.Pp
If the package
.Li python3
is installed, a package with a file under
.Pa /usr/lib/python Ns Ar X.Y Ns Pa /
is broken when
.Ar X.Y
is not the major and minor version of that package.
.Pp
If the package
.Li perl
is installed, a package with a file under
.Pa /usr/lib/perl5/site_perl/ Ns Ar version Ns Pa /
is broken when
.Ar version
is not the version of that package.
.Sh FILES
.Bl -tag -width Ds
.It Pa /var/lib/pkg/db
Package database.
.It Pa /etc/revdep.d/ Ns Ar package
Extra library directories for the files of
.Ar package ,
one per line.
Lines starting with
.Ql #
are comments.
.It Pa /etc/ld-musl-x86_64.path
System library path of the musl dynamic linker, if present.
.El
.Sh EXIT STATUS
Without
.Fl r ,
.Nm
exits 0 if no checked package is broken and 1 otherwise.
With
.Fl r ,
finding dependent packages is not an error; it exits 0.
Both exit 1 if a named package is not installed or the package
database cannot be read.
.Sh EXAMPLES
Check every installed package:
.Pp
.Dl # revdep
.Pp
Check two packages, showing the broken files:
.Pp
.Dl # revdep -vv firefox chromium
.Pp
After updating wlroots and wayland, list what links against them:
.Pp
.Dl # revdep -r wlroots wayland
.Pp
Check everything except the kernel and firmware:
.Pp
.Dl # revdep -i linux,linux-firmware
.Pp
To rebuild a broken package, raise
.Va release
in its port and run
.Ic pkg sysup ;
see
.Xr pkg 8 .
.Sh SEE ALSO
.Xr ldd 1 ,
.Xr readelf 1 ,
.Xr addpkg 8 ,
.Xr infopkg 8 ,
.Xr mkpkg 8 ,
.Xr pkg 8
.Sh AUTHORS
.An zorz Aq Mt zorz@gmx.com ,
after the
.Nm
of James Buren for CRUX.
.Sh CAVEATS
musl also looks for a library in the
.Dv DT_RPATH
or
.Dv DT_RUNPATH
of the program or library that loaded the one needing it.
.Nm
checks each file on its own, so a library found only that way is
reported missing.
|