Public bug reported:

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?

** Affects: chromium-browser (Ubuntu)
     Importance: Undecided
         Status: New

** Description changed:

  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 unmodified /usr/bin/chromium-browser, then my scripts leads to
+ 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
+    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
+    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
+    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 
+    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
  
- I run to manually
+ 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?

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1809105

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

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/chromium-browser/+bug/1809105/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to