DEP8 test incorrectly copies packages into container

Bug #2012299 reported by Andreas Hasenack
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
docker.io (Ubuntu)
Fix Released
Wishlist
Michał Małoszewski

Bug Description

This function[1] used in the DEP8 test:

copy_local_apt_files() {
  for local_source in $(apt-get indextargets | grep-dctrl -F URI -e '^file:/' -sURI); do
    local_source=${local_source#file:}
    local_dir=$(dirname "${local_source}")
    lxc exec docker -- mkdir -p "${local_dir}"
    tar -cC "${local_dir}" . | lxc exec docker -- tar -xC "${local_dir}"
  done
}

Doesn't account for the fact that the result of that apt-get indextargets call still has the URI field name in it:

$ apt-get indextargets | grep-dctrl -F URI -e '^file:/' -sURI
URI: file:/tmp/autopkgtest.EOdj4s/binaries/Packages

That will make local_source be URI: first, then file:/.... second, and so on.

When given a string like "URI:", dirname returns just ".". That tar command then transfers "." to the container.

https://github.com/tianon/debian-docker/blob/ubuntu/debian/tests/docker-in-lxd#L53

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

AFAICS dirname returns the full string if it isn't a file, not "." (at least for me).
But still you are right that this isn't doing what is intended.

I agree that nowadays a prefix filter like this would be needed:
  ${local_source#URI: file:}

Maybe it was starting with just "file:" in an older version?

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

Not here (kinetic):

$ dirname hfiodshfioeh
.

Maybe we are talking about different things?

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

FYI: Discussion concluded, now queued as PR to the packaging at:
https://github.com/tianon/debian-docker/pull/20

Will be closed once that arrives in Ubuntu

Changed in docker.io (Ubuntu):
status: New → Fix Committed
Changed in docker.io (Ubuntu):
assignee: nobody → Michał Małoszewski (michal-maloszewski99)
Changed in docker.io (Ubuntu):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.