bugGnash - The GNU Flash player - Bugs: bug #50462, Gnash shows weird version...

 
 

bug #50462: Gnash shows weird version information when built from detached-HEAD Git repository

Submitter:  Nutchanon Wetchasit <nachanon>
Submitted:  Sun 05 Mar 2017 03:59:04 PM UTC
   
 
Category:  build Severity:  3 - Normal
Release:  master Status:  Fixed
Privacy:  Public Assigned to:  strk
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Wed 08 Mar 2017 10:08:40 AM UTC, comment #10: 

Pushed as 2383a5618a88db2c94c3b593a12ed020b8657bea

Sandro Santilli <strk>
Group Member
Wed 08 Mar 2017 09:48:21 AM UTC, comment #9: 

Build results of the fixed patch (file #39935) on my system are as follows...

On-tree build, 144e082 on `master` branch:

$ git checkout -f master && patch -i /tmp/0001_use-git-symbolicref-for-revno-branch-v2.patch && ./autogen.sh && CC="ccache gcc" CXX="ccache g++" ./configure --enable-media=ffmpeg,gst --enable-renderer=agg,cairo,opengl --enable-gui=gtk,qt4,sdl,fb,dump --enable-docbook && make

...Output omitted...

$ gui/gtk-gnash --version
Gnash 0.8.11dev (master-22387-144e082)

Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
Gnash comes with NO WARRANTY, to the extent permitted by law.
You may redistribute copies of Gnash under the terms of the GNU General
Public License.  For more information, see the file named COPYING.

Build options
   Renderers: agg cairo opengl
   Hardware Acceleration: RawFB
   GUI: GTK
   Media handlers: ffmpeg gst
   Configured with: --enable-media=ffmpeg,gst --enable-renderer=agg,cairo,opengl --enable-gui=gtk,qt4,sdl,fb,dump --enable-docbook
   CXXFLAGS: -g -O2 -std=c++11          -W     -Wall     -Wcast-qual     -Wpointer-arith     -Wreturn-type     -Wnon-virtual-dtor     -Wunused      -fvisibility-inlines-hidden -fvisibility=hidden -fpie -fPIE -Wformat -Werror=format-security -fstack-protector --param ssp-buffer-size=4
$


On-tree build, detached HEAD at 144e082:

$ git checkout -f 144e082 && patch -i /tmp/0001_use-git-symbolicref-for-revno-branch-v2.patch && ./autogen.sh && CC="ccache gcc" CXX="ccache g++" ./configure --enable-media=ffmpeg,gst --enable-renderer=agg,cairo,opengl --enable-gui=gtk,qt4,sdl,fb,dump --enable-docbook && make

...Output omitted...

$ gui/gtk-gnash --version
Gnash 0.8.11dev (none-22387-144e082)

Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
Gnash comes with NO WARRANTY, to the extent permitted by law.
You may redistribute copies of Gnash under the terms of the GNU General
Public License.  For more information, see the file named COPYING.

Build options
   Renderers: agg cairo opengl
   Hardware Acceleration: RawFB
   GUI: GTK
   Media handlers: ffmpeg gst
   Configured with: --enable-media=ffmpeg,gst --enable-renderer=agg,cairo,opengl --enable-gui=gtk,qt4,sdl,fb,dump --enable-docbook
   CXXFLAGS: -g -O2 -std=c++11          -W     -Wall     -Wcast-qual     -Wpointer-arith     -Wreturn-type     -Wnon-virtual-dtor     -Wunused      -fvisibility-inlines-hidden -fvisibility=hidden -fpie -fPIE -Wformat -Werror=format-security -fstack-protector --param ssp-buffer-size=4
$


Off-tree build, 144e082 on `master` branch:

$ git checkout -f master && patch -i /tmp/0001_use-git-symbolicref-for-revno-branch-v2.patch && ./autogen.sh && mkdir -p /tmp/gnash-build && cd /tmp/gnash-build && CC="ccache gcc" CXX="ccache g++" ~/prog/gnash.git/configure --enable-media=ffmpeg,gst --enable-renderer=agg,cairo,opengl --enable-gui=gtk,qt4,sdl,fb,dump --enable-docbook && make

...Output omitted...

$ gui/gtk-gnash --version
Gnash 0.8.11dev (master-22387-144e082)

Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
Gnash comes with NO WARRANTY, to the extent permitted by law.
You may redistribute copies of Gnash under the terms of the GNU General
Public License.  For more information, see the file named COPYING.

Build options
   Renderers: agg cairo opengl
   Hardware Acceleration: RawFB
   GUI: GTK
   Media handlers: ffmpeg gst
   Configured with: --enable-media=ffmpeg,gst --enable-renderer=agg,cairo,opengl --enable-gui=gtk,qt4,sdl,fb,dump --enable-docbook
   CXXFLAGS: -g -O2 -std=c++11          -W     -Wall     -Wcast-qual     -Wpointer-arith     -Wreturn-type     -Wnon-virtual-dtor     -Wunused      -fvisibility-inlines-hidden -fvisibility=hidden -fpie -fPIE -Wformat -Werror=format-security -fstack-protector --param ssp-buffer-size=4
$


Off-tree build, detached HEAD at 144e082:

$ git checkout -f 144e082 && patch -i /tmp/0001_use-git-symbolicref-for-revno-branch-v2.patch && ./autogen.sh && mkdir -p /tmp/gnash-build && cd /tmp/gnash-build && CC="ccache gcc" CXX="ccache g++" ~/prog/gnash.git/configure --enable-media=ffmpeg,gst --enable-renderer=agg,cairo,opengl --enable-gui=gtk,qt4,sdl,fb,dump --enable-docbook && make

...Output omitted...

$ gui/gtk-gnash --version
Gnash 0.8.11dev (none-22387-144e082)

Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
Gnash comes with NO WARRANTY, to the extent permitted by law.
You may redistribute copies of Gnash under the terms of the GNU General
Public License.  For more information, see the file named COPYING.

Build options
   Renderers: agg cairo opengl
   Hardware Acceleration: RawFB
   GUI: GTK
   Media handlers: ffmpeg gst
   Configured with: --enable-media=ffmpeg,gst --enable-renderer=agg,cairo,opengl --enable-gui=gtk,qt4,sdl,fb,dump --enable-docbook
   CXXFLAGS: -g -O2 -std=c++11          -W     -Wall     -Wcast-qual     -Wpointer-arith     -Wreturn-type     -Wnon-virtual-dtor     -Wunused      -fvisibility-inlines-hidden -fvisibility=hidden -fpie -fPIE -Wformat -Werror=format-security -fstack-protector --param ssp-buffer-size=4
$


You would see that the version displays are now showing expected branch nickname in both normal and detached-HEAD repository, and in both on-tree and off-tree build configuration.

Gnash: 0.8.11dev (patched against git 144e082 22-Feb-2017)
Git: 1:1.7.10.4-1+wheezy1 (debian)
System: Debian GNU/Linux 7.0 Wheezy i386

Nutchanon Wetchasit <nachanon>
Wed 08 Mar 2017 09:43:17 AM UTC, comment #8: 

I have re-checked the patch with on-tree and off-tree building: the problem seems to caused by an error on my part, sorry. (It's a mix-up between Make's and Make's sub-shell variable)

From Makefile patched by original patch (file #39917):

            nick="`basename "$(nick)"`"; \
            if test -z "$(nick)"; then \
                  nick="none"; \
            fi; \


It should have been...

            nick="`basename "$${nick}"`"; \
            if test -z "$${nick}"; then \
                  nick="none"; \
            fi; \


As there's no Make variable named "nick", it causes branch nickname to always be assigned as "none"; no matter that Git HEAD is currently on a valid branch or not. On-tree V.S. off-tree building configuration is irrelevant in this case.

I have attached the corrected patch as `0001_use-git-symbolicref-for-revno-branch-v2.patch`.

Gnash: 0.8.11dev (patched against git 144e082 22-Feb-2017)
Git: 1:1.7.10.4-1+wheezy1 (debian)
System: Debian GNU/Linux 7.0 Wheezy i386


(file #39935)

Nutchanon Wetchasit <nachanon>
Tue 07 Mar 2017 01:38:47 PM UTC, comment #7: 

Ok with "none" then, but I've tried your patch and I get "none" even when I'm on a valid branch. This is with Git 2.7.4 - note that both symbolic-ref -q HEAD and basename work fine when invoked manually, so there must be another issue (my build dir is outside the source dir, in case that matters)

Sandro Santilli <strk>
Group Member
Tue 07 Mar 2017 01:07:28 PM UTC, comment #6: 

@strk,
In detached HEAD mode, `git branch --contains REVSHA1` does not seem to work like expected:

$ git checkout 144e082
Note: checking out '144e082'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b new_branch_name

HEAD is now at 144e082... Note fscommand support in MovieClip.getURL
$ git branch
* (no branch)
  master
$ git branch --contains 144e082
* (no branch)
  master
$


You would see that the highlighted branch name is still "(no branch)".

Gnash: 0.8.11dev (git 144e082 22-Feb-2017)
Git: 1:1.7.10.4-1+wheezy1 (debian)
System: Debian GNU/Linux 7.0 Wheezy i386

Nutchanon Wetchasit <nachanon>
Tue 07 Mar 2017 11:21:55 AM UTC, comment #5: 

How about picking a branch containing the commit ?
In the example case you're making I see "master" branch
does contain 144e082:

```
git branch --contains 144e082
```

Sandro Santilli <strk>
Group Member
Tue 07 Mar 2017 10:12:48 AM UTC, comment #4: 

Patch included, see below.

These patches use a combination of `git symbolic-ref -q HEAD` and `basename` to determine current branch. All of them do the same thing, but use a different placeholder branch nickname when current branch cannot be determined; only one can be chosen for inclusion in mainline.

Choice 1. Use "none" when current branch cannot be determined:
0001_use-git-symbolicref-for-revno-branch.patch (file #39917)

Gnash 0.8.11dev (none-22387-144e082)

Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
Gnash comes with NO WARRANTY, to the extent permitted by law.
You may redistribute copies of Gnash under the terms of the GNU General
Public License.  For more information, see the file named COPYING.

Build options
   Renderers: agg cairo opengl
   Hardware Acceleration: RawFB
   GUI: GTK
   Media handlers: ffmpeg gst
   Configured with: --enable-media=ffmpeg,gst --enable-renderer=agg,cairo,opengl --enable-gui=gtk,qt4,sdl,fb,dump --enable-docbook
   CXXFLAGS: -g -O2 -std=c++11          -W     -Wall     -Wcast-qual     -Wpointer-arith     -Wreturn-type     -Wnon-virtual-dtor     -Wunused      -fvisibility-inlines-hidden -fvisibility=hidden -fpie -fPIE -Wformat -Werror=format-security -fstack-protector --param ssp-buffer-size=4

(Screenshot of About Gnash dialog:

Choice 2. Use "unknown" when current branch cannot be determined:
0001_use-git-symbolicref-for-revno-branch-unknown-placeholder.patch (file #39919)

Gnash 0.8.11dev (unknown-22387-144e082)

Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
Gnash comes with NO WARRANTY, to the extent permitted by law.
You may redistribute copies of Gnash under the terms of the GNU General
Public License.  For more information, see the file named COPYING.

Build options
   Renderers: agg cairo opengl
   Hardware Acceleration: RawFB
   GUI: GTK
   Media handlers: ffmpeg gst
   Configured with: --enable-media=ffmpeg,gst --enable-renderer=agg,cairo,opengl --enable-gui=gtk,qt4,sdl,fb,dump --enable-docbook
   CXXFLAGS: -g -O2 -std=c++11          -W     -Wall     -Wcast-qual     -Wpointer-arith     -Wreturn-type     -Wnon-virtual-dtor     -Wunused      -fvisibility-inlines-hidden -fvisibility=hidden -fpie -fPIE -Wformat -Werror=format-security -fstack-protector --param ssp-buffer-size=4

(Screenshot of About Gnash dialog:

Choice 3. Use pre-written version from configure.ac's `AC_INIT` when current branch cannot be determined:
0001_use-git-symbolicref-for-revno-branch-version-placeholder.patch (file #39921)

Gnash 0.8.11dev (0.8.11dev-22387-144e082)

Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
Gnash comes with NO WARRANTY, to the extent permitted by law.
You may redistribute copies of Gnash under the terms of the GNU General
Public License.  For more information, see the file named COPYING.

Build options
   Renderers: agg cairo opengl
   Hardware Acceleration: RawFB
   GUI: GTK
   Media handlers: ffmpeg gst
   Configured with: --enable-media=ffmpeg,gst --enable-renderer=agg,cairo,opengl --enable-gui=gtk,qt4,sdl,fb,dump --enable-docbook
   CXXFLAGS: -g -O2 -std=c++11          -W     -Wall     -Wcast-qual     -Wpointer-arith     -Wreturn-type     -Wnon-virtual-dtor     -Wunused      -fvisibility-inlines-hidden -fvisibility=hidden -fpie -fPIE -Wformat -Werror=format-security -fstack-protector --param ssp-buffer-size=4

(Screenshot of About Gnash dialog:

Portability notes:

  • A use of `basename` shouldn't be problem since `configure` is already using it.
  • `git symbolic-ref -q HEAD` works in expected manner at least in Git 1.5.6.5, 1.7.10.4, and 2.11.1.


Gnash: 0.8.11dev (patched against git 144e082 22-Feb-2017)
Git: 1:1.7.10.4-1+wheezy1 (debian)
System: Debian GNU/Linux 7.0 Wheezy i386

Nutchanon Wetchasit <nachanon>
Sun 05 Mar 2017 05:24:08 PM UTC, comment #3: 

And another question is: what branch nickname should be displayed when the repository HEAD is not on any branch?

One possible choice is using "none"...

Gnash 0.8.11dev (none-22387-144e082)


Or use "unknown"...

Gnash 0.8.11dev (unknown-22387-144e082)


Or use a pre-written `$VERSION`...
(This is currently used when Gnash is built out of Git repository)

Gnash 0.8.11dev (0.8.11dev-22387-144e082)


Or omit the branch part and its following dash entirely...
(This would require changing how version string is built when such case is encountered)

Gnash 0.8.11dev (22387-144e082)


Gnash: 0.8.11dev (git 144e082 22-Feb-2017)
System: Debian GNU/Linux 7.0 Wheezy i386

Nutchanon Wetchasit <nachanon>
Sun 05 Mar 2017 04:34:23 PM UTC, comment #2: 

Previous post's markup is messed up a bit, here is a repost:

This oddity seems to boil down to how Gnash build script extracts branch information from the repository...

Makefile.am:161:

nick="`cd $(top_srcdir) ; $(GIT) branch | grep '^\*' | cut -d ' ' -f 2`"; \


Running `git branch` in the repository after `git checkout 144e082` shows:

$ git branch
* (no branch)
  master
$


Since what branch retrieval command did is finding line beginning with "*" and use its 2nd column (separated by space). So "(no branch)" became "(no" displayed in the version string:

$ git branch | grep '^\*' | cut -d ' ' -f 2
(no
$


If a more modern version of git (e.g. 2.11.1) is used, output would be even more weird:

$ git --version
git version 2.11.1
$ git branch
* (HEAD detached at 144e08270)
  master
$ git branch | grep '^\*' | cut -d ' ' -f 2
(HEAD
$


Maybe a fix would involve changing the source of branch information from porcelain `git branch` (which is prone to format changes) to something low-level like `git symbolic-ref` (which is recommended for scripting).

Gnash: 0.8.11dev (git 144e082 22-Feb-2017)
Git: 1:1.7.10.4-1+wheezy1 (debian)
Git: 2.11.1 (source)
System: Debian GNU/Linux 7.0 Wheezy i386

Nutchanon Wetchasit <nachanon>
Sun 05 Mar 2017 04:30:58 PM UTC, comment #1: 

This seems to boil down to how Gnash build script extracts branch information from the repository...

Makefile.am:161:

nick="`cd $(top_srcdir) ; $(GIT) branch | grep '^\*' | cut -d ' ' -f 2`"; \


Running `git branch` in the repository after `git checkout 144e082` shows:

$ git branch
* (no branch)
  master
$


Since what branch retrieval command did is finding line beginning with "*" and use its 2nd column (separated by space). So "(no branch)" became "(no" displayed in the version string:

$ git branch | grep '^\*' | cut -d ' ' -f 2
(no
$
-verbatim+

If a more modern version of git (e.g. 2.11.1) is used, output would be even more weird:
+verbatim+
$ git --version
git version 2.11.1
$ git branch
* (HEAD detached at 144e08270)
  master
$ git branch | grep '^\*' | cut -d ' ' -f 2
(HEAD
$


Maybe a fix would involve changing the source of branch information from porcelain `git branch` (which is prone to format changes) to something low-level like `git symbolic-ref` (which is recommended for scripting).

Gnash: 0.8.11dev (git 144e082 22-Feb-2017)
Git: 1:1.7.10.4-1+wheezy1 (debian)
Git: 2.11.1 (source)
System: Debian GNU/Linux 7.0 Wheezy i386

Nutchanon Wetchasit <nachanon>
Sun 05 Mar 2017 03:59:04 PM UTC, original submission:  

This is a minor issue, but it would be nice if it get fixed.

While I was going back and forth in local Gnash Git repository, I ran into some oddity when I leave the repository in detatched HEAD mode (a la `git checkout REVSHA1`): I found that Gnash built from that repository would show a weird version string:

$ git checkout 144e082
Note: checking out '144e082'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b new_branch_name

HEAD is now at 144e082... Note fscommand support in MovieClip.getURL
$ ./autogen.sh && CC="ccache gcc" CXX="ccache g++" ./configure --enable-media=ffmpeg,gst --enable-renderer=agg,cairo,opengl --enable-gui=gtk,qt4,sdl,fb,dump --enable-docbook && make && su -c "make install"

...Output omitted...

$ gnash --version
Gnash 0.8.11dev ((no-22387-144e082)

Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
Gnash comes with NO WARRANTY, to the extent permitted by law.
You may redistribute copies of Gnash under the terms of the GNU General
Public License.  For more information, see the file named COPYING.

Build options
   Renderers: agg cairo opengl
   Hardware Acceleration: RawFB
   GUI: GTK
   Media handlers: ffmpeg gst
   Configured with: --enable-media=ffmpeg,gst --enable-renderer=agg,cairo,opengl --enable-gui=gtk,qt4,sdl,fb,dump --enable-docbook
   CXXFLAGS: -g -O2 -std=c++11          -W     -Wall     -Wcast-qual     -Wpointer-arith     -Wreturn-type     -Wnon-virtual-dtor     -Wunused      -fvisibility-inlines-hidden -fvisibility=hidden -fpie -fPIE -Wformat -Werror=format-security -fstack-protector --param ssp-buffer-size=4
$


You would see that the branch part displayed in the version string is "(no", which is not normal; and this oddity also show up in GTK-Gnash's About dialog too (see the attached screenshot).

This problem does not seem to affect usability of the build, though it may cause confusion when user try to report bugs in Gnash built from that kind of repository configuration.

Gnash: 0.8.11dev (git 144e082 22-Feb-2017)
Git: 1:1.7.10.4-1+wheezy1 (debian)
System: Debian GNU/Linux 7.0 Wheezy i386

Nutchanon Wetchasit <nachanon>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #39935:  0001_use-git-symbolicref-for-revno-branch-v2.patch added by nachanon (1KiB - text/x-diff - A corrected patch to use "git symbolic-ref" for branch info, or "none" when fail)
file #39922:  aboutgnash_0.8.11dev-144e082_versionplaceholder.png added by nachanon (9KiB - image/png - About Gnash dialog (built with detatched HEAD) after applied `0001_use-git-symbolicref-for-revno-branch-version-placeholder.patch`)
file #39921:  0001_use-git-symbolicref-for-revno-branch-version-placeholder.patch added by nachanon (1KiB - application/octet-stream - Patch to use "git symbolic-ref" for branch info, or $VERSION when fail)
file #39920:  aboutgnash_0.8.11dev-144e082_unknownplaceholder.png added by nachanon (9KiB - image/png - About Gnash dialog (built with detatched HEAD) after applied `0001_use-git-symbolicref-for-revno-branch-unknown-placeholder.patch`)
file #39919:  0001_use-git-symbolicref-for-revno-branch-unknown-placeholder.patch added by nachanon (1KiB - application/octet-stream - Patch to use "git symbolic-ref" for branch info, or "unknown" when fail)
file #39918:  aboutgnash_0.8.11dev-144e082_noneplaceholder.png added by nachanon (8KiB - image/png - About Gnash dialog (built with detatched HEAD) after applied `0001_use-git-symbolicref-for-revno-branch.patch`)
file #39917:  0001_use-git-symbolicref-for-revno-branch.patch added by nachanon (1KiB - application/octet-stream - Patch to use "git symbolic-ref" for branch info, or "none" when fail)
file #39895:  aboutgnash_0.8.11dev-144e082.png added by nachanon (8KiB - image/png - About Gnash dialog from Gnash 0.8.11dev git 144e082, built in detatched-HEAD mode)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by strk (Posted a comment)
  • -email is unavailable- added by nachanon (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 11 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2017-03-08 strk StatusNone Fixed
        Assigned toNone strk
        Open/ClosedOpen Closed
    2017-03-08 nachanon Attached File- Added 0001_use-git-symbolicref-for-revno-branch-v2.patch, #39935
    2017-03-07 nachanon Attached File- Added aboutgnash_0.8.11dev-144e082_versionplaceholder.png, #39922
    2017-03-07 nachanon Attached File- Added 0001_use-git-symbolicref-for-revno-branch-version-placeholder.patch, #39921
    2017-03-07 nachanon Attached File- Added aboutgnash_0.8.11dev-144e082_unknownplaceholder.png, #39920
    2017-03-07 nachanon Attached File- Added 0001_use-git-symbolicref-for-revno-branch-unknown-placeholder.patch, #39919
    2017-03-07 nachanon Attached File- Added aboutgnash_0.8.11dev-144e082_noneplaceholder.png, #39918
    2017-03-07 nachanon Attached File- Added 0001_use-git-symbolicref-for-revno-branch.patch, #39917
    2017-03-05 nachanon Attached File- Added aboutgnash_0.8.11dev-144e082.png, #39895

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code