Broken setting custom flags in /usr/bin/chromium-browser script

Bug #1809105 reported by Mikhail Novosyolov
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
chromium-browser (Ubuntu)
New
Undecided
Unassigned

Bug Description

To workaround LP#1808853 (https://bugs.launchpad.net/bugs/1808853) I tried to make the following script (/etc/chromium-browser/customizations/20-chromium-useragent-fix):

https://gitlab.com/mikhailnov/nastr/blob/master/chromium-useragent-fix.sh

But it does not work due to probably an error in /usr/bin/chromium-browser

If use an unmodified /usr/bin/chromium-browser, then my scripts leads to openning multiple tabs, because --useagent=VALUE is passed as multiple arguements, not one.

I've made a patch:
--- ./chromium-browser 2018-12-17 04:53:00.000000000 +0300
+++ /tmp/chromium-browser 2018-12-19 14:16:29.186960503 +0300
@@ -207,16 +207,16 @@
   echo "$GDB $LIBDIR/$APPNAME -x $tmpfile"
   $GDB "$LIBDIR/$APPNAME" -x $tmpfile
   if [ $want_temp_profile -eq 1 ] ; then
- rm -rf $TEMP_PROFILE
+ rm -rf ${TEMP_PROFILE:?}/*
   fi
   exit $?
 else
   if [ $want_temp_profile -eq 0 ] ; then
- exec $LIBDIR/$APPNAME $CHROMIUM_FLAGS "$@"
+ exec "$LIBDIR/$APPNAME" "$CHROMIUM_FLAGS" "$@"
   else
     # we can't exec here as we need to clean-up the temporary profile
- $LIBDIR/$APPNAME $CHROMIUM_FLAGS "$@"
- rm -rf $TEMP_PROFILE
+ "$LIBDIR/$APPNAME" "$CHROMIUM_FLAGS" "$@"
+ rm -rf ${TEMP_PROFILE:?}/*
   fi
 fi

After this multiple pages are not openned, but, if we run
$ bash -x /usr/bin/chromium-browser
we see:
+ exec /usr/lib/chromium-browser/chromium-browser ' --ppapi-flash-path=/usr/lib/adobe-flashplugin/libpepflashplayer.so --ppapi-flash-version=32.0.0.101 --user-agent=Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.80 Safari/537.36 --enable-pinch' https://yandex.ru/internet

the problem is in ' ', new user-agent is not applied

If to run manually
$ /usr/lib/chromium-browser/chromium-browser --ppapi-flash-path=/usr/lib/adobe-flashplugin/libpepflashplayer.so --ppapi-flash-version=32.0.0.101 --user-agent=Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.80 Safari/537.36 --enable-pinch https://yandex.ru/internet

then setting a custom useragent does work.

What can be done?

description: updated
Revision history for this message
Nathan Teodosio (nteodosio) wrote :

Please let me know if I misunderstood and this isn't a duplicate.

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.