Reputation: 61
I have the following code inside a spec file:
mkdir -p %{buildroot}%{_qt6_bindir}
pushd %{buildroot}%{_qt6_bindir}
for i in * ; do
case "${i}" in
qdbuscpp2xml|qdbusxml2cpp|qtpaths)
ln -v ${i} %{buildroot}%{_bindir}/${i}-qt6
;;
*)
ln -v ${i} %{buildroot}%{_bindir}/${i}
;;
esac
done
popd
when i run build i got following error:
ln: target '/home/abuild/rpmbuild/BUILDROOT/qt6-qtbase-6.4.3-1.x86_64/usr/bin/qtpaths6': Not a directory
where qtpath6 is an excutable file. how to fix this error?
Upvotes: 5
Views: 3659
Reputation: 58578
What's going on is that a component of the target path is not a directory. I can reproduce the problem like this:
$ ln /etc/hosts/foo bar
ln: failed to access '/etc/hosts/foo': Not a directory
That's because /etc/hosts
is a file. I picked that well-known file to make it obvious.
(The wording of the diagnostic is not exactly the same in my version of ln
as you can see.)
What's probably happening is that ln
calls the link
system call, which fails with a -1 and an errno
of ENOTDIR
. The program just translates that error to Not a directory
via strerror
, and attributes the error to the target path as such.
We know that ln
cannot possibly be complaining that the target isn't a directory, because that is specifically disallowed: you cannot make a hard link to a directory!
$ ln /etc ./etc
ln: /etc: hard link not allowed for directory
Upvotes: 3