#20592: relocate-once.py does not handle local/bin/gp-2.8
--------------------------------+------------------------------
Reporter: ehlen | Owner:
Type: defect | Status: needs_info
Priority: blocker | Milestone: sage-7.3
Component: distribution | Resolution:
Keywords: | Merged in:
Authors: | Reviewers: Jeroen Demeyer
Report Upstream: N/A | Work issues:
Branch: | Commit:
Dependencies: | Stopgaps:
--------------------------------+------------------------------
Comment (by nbruin):
I've looked in the GP binary and the to-be-replaced path occurs 3 times in
the file: (writing \0 for a zero byte. All other characters around it are
ascii):
{{{
\0__bss_start\0/mnt/disk/home/buildslave-
sage/slave/binary_pkg/build/source/SageMath/jc4b6yulaujayb9sr94ia88eourzeq/local/lib:/mnt/disk/home
/buildslave-
sage/slave/binary_pkg/build/source/SageMath/jc4b6yulaujayb9sr94ia88eourzeq/local/lib:/mnt/disk/home
/buildslave-
sage/slave/binary_pkg/build/source/SageMath/jc4b6yulaujayb9sr94ia88eourzeq/local/lib:/usr/lib\0rectcolor\0
}}}
so the to-be-replaced string occurs several times in what seems to be a
0-terminated string. Can't we just:
- scan for the pattern
- get the shortest 0-terminated block that contains the pattern
- verify that this block looks like an ascii string
- do a search-and-replace on the string
- check that the new string isn't longer than what it was before
- pad the new string with 0-bytes so that it has the right length, and
make this the new block
- overwrite the old block with the new block
I checked on the GP binary, and executing the recipe above on it (well, I
used a hex editor for this one-off operation) leads to a functioning
executable. We're making a bit of an assumption that padding with 0 is an
allowable thing to do. Apparently it is in the case of the gp executable.
If it's too risky in general, perhaps only allow this recipe on
whitelisted files (and whitelist the gp executable)?
--
Ticket URL: <http://trac.sagemath.org/ticket/20592#comment:21>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.