After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 702040 - very strange gnome-doc-utils check in gparted
very strange gnome-doc-utils check in gparted
Status: RESOLVED FIXED
Product: gparted
Classification: Other
Component: application
unspecified
Other All
: Normal normal
: ---
Assigned To: gparted maintainers alias
gparted maintainers alias
Depends on:
Blocks:
 
 
Reported: 2013-06-11 20:04 UTC by Allison Karlitskaya (desrt)
Modified: 2013-09-18 16:52 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Stop using locate in autogen.sh (v1) (1.39 KB, patch)
2013-06-14 13:21 UTC, Mike Fleetwood
none Details | Review

Description Allison Karlitskaya (desrt) 2013-06-11 20:04:32 UTC
in autogen.sh:

# Check for GNOME-DOC-UTILS
GDUMAKE="gnome-doc-utils.make"
GDUMAKEFULLPATH=`locate $GDUMAKE | grep -m 1 "gnome-doc-utils/"`
if test "x${GDUMAKEFULLPATH}" = "x" ; then 
        echo "Cannot find file: $GDUMAKE"
        echo "You need to install gnome-doc-utils"
        exit 1
fi



using 'locate' is wrong for so many reasons....
Comment 1 Curtis Gedak 2013-06-12 17:06:35 UTC
Thank you Ryan for your interest in improving GParted.

Are you suggesting the logic be changed to be similar to that of the gparted.in script?

For example:

# Check for GNOME-DOC-UTILS
HAVE_GDU=no
GDUPREPARE="gnome-doc-prepare"
for k in '' `echo "$PATH" | sed 's,:, ,g'`; do
	if test -x "$k/$GDUPREPARE"; then
		HAVE_GDU=yes
		break
	fi
done
if test "x${HAVE_GDU}" = "xno" ; then 
        echo "Cannot find file: $GDUPREPARE"
        echo "You need to install gnome-doc-utils"
        exit 1
fi


Or do you have another suggestion?


The key thing is that the script notify that a package needed to build GParted from git is missing.
Comment 2 Allison Karlitskaya (desrt) 2013-06-12 18:03:22 UTC
I think the best would be to use pkg-config.  gnome-doc-utils installs a .pc file.
Comment 3 Curtis Gedak 2013-06-12 19:36:01 UTC
Do you have an example?

Also, what if gnome-doc-utils is installed from source code and not from a package?
Comment 4 Allison Karlitskaya (desrt) 2013-06-12 19:47:02 UTC
Something along these lines:

if pkg-config --exists gnome-doc-utils; then
  echo good...
else
  echo bad...
fi


.pc files are part of upstream projects and have nothing to do with distribution packages.  They will be installed when building from source.
Comment 5 Mike Fleetwood 2013-06-13 09:59:15 UTC
How do we get from good/bad to knowing the path to gnome-doc-utils.make
so we can copy the file for the next section of code in autogen.sh?


# Ensure a copy of gnome-doc-utils.make exists in the top source directory
test -e $srcdir/$GDUMAKE || {
        echo "Copying $GDUMAKEFULLPATH to $srcdir"
        cp -p $GDUMAKEFULLPATH $srcdir
}
Comment 6 Curtis Gedak 2013-06-13 18:55:42 UTC
Good point Mike (in comment #5).

The script autogen.sh is only used to build GParted from the git repository.  As such without a good solution to comment #5, I lean towards leaving the code as-is.

Since typically autogen.sh is used by developers or advanced users, I do not believe that the use of locate is much of a problem.

Ryan,

Do you have a solution to Mike's question in comment #5?
Comment 7 Allison Karlitskaya (desrt) 2013-06-13 20:18:12 UTC
I'd go with something along these lines:

GDUMAKEFULLPATH="`pkg-config --variable=datadir gnome-doc-utils`/gnome-doc-utils/gnome-doc-utils.make"
Comment 8 Mike Fleetwood 2013-06-14 11:33:29 UTC
Hi Ryan,

(In reply to comment #0)
> using 'locate' is wrong for so many reasons....

Can you tell me those reasons please.  The only issue I have is when I
install a new distro I have to run updatedb to update the locate
database before I can run ./autogen.sh to build GParted for the first
time.

Thanks,
Mike
Comment 9 Allison Karlitskaya (desrt) 2013-06-14 11:41:06 UTC
The updatedb issue is a big deal, I think... it caught me... I was getting frustrated wondering why I couldn't autogen despite the fact that I had clearly installed this file.

Using pkg-config also makes sure that we find the right version (jhbuild install vs. system install) according to the user's environment (which jhbuild takes care to setup properly).

Additionally, it's a security problem.  If you have some malicious user on the system who puts a copy of gnome-doc-utils.make into their home directory and it happens to show up in the 'locate' output before the system one, then you will copy it out of their home directory and execute whatever is inside of it as the current user...
Comment 10 Mike Fleetwood 2013-06-14 13:21:14 UTC
Created attachment 246806 [details] [review]
Stop using locate in autogen.sh (v1)

Hi Curtis,

Here's a patch for this.

Tested on Fedora 14 and CentOS 5.9.
Tested removing gnome-doc-uitls package and just removing the
gnome-doc-utils.make file.
Tested make distcheck.

Looked at the gnome-doc-utils make file which installs g-d-u.make.
https://git.gnome.org/browse/gnome-doc-utils/tree/tools/Makefile.am

It is more obvious looking at the generated Makefile.in.  g-d-u.make is
installed in the directory $datadir/gnome-doc-utils/ presumably with
datadir being set by ./configure and recorded in the pkg-config .pc
metadata file.

Thanks,
Mike
Comment 11 Curtis Gedak 2013-06-14 16:56:35 UTC
Thank you Mike for digging deeper and developing a patch, and thank you Ryan for raising this report and working towards a solution.

I tested the patch in comment #10 on the following distros:

  kubuntu  12.04
  Debian   6
  openSUSE 12.2

The patch passed all of my testing.

This enhancement has been committed to the gnome repository for inclusion in the next release of GParted.

The relevant git commit can be viewed at the following link:

Stop using locate in autogen.sh (#702040)
https://git.gnome.org/browse/gparted/commit/?id=f77d4e65a92a721d61a1212b3282a6cc87de8579
Comment 12 Allison Karlitskaya (desrt) 2013-06-15 20:17:03 UTC
Review of attachment 246806 [details] [review]:

::: autogen.sh
@@ +28,3 @@
 # Check for GNOME-DOC-UTILS
 GDUMAKE="gnome-doc-utils.make"
+datadir=`pkg-config --variable=datadir gnome-doc-utils`

Could probably use some more quoting here in case someone is silly and has a space in their prefix...
Comment 13 Mike Fleetwood 2013-06-16 11:26:28 UTC
Review of attachment 246806 [details] [review]:

This works as expected in both bash and ash shells:
  $ a=`echo foo bar`
  $ echo $a
  foo bar
Additional quoting isn't necessary.
Comment 14 Curtis Gedak 2013-09-18 16:52:24 UTC
The patch to address this report has been included in GParted 0.16.2 released on September 18, 2013.