{"id":69,"date":"2009-05-04T19:12:53","date_gmt":"2009-05-04T23:12:53","guid":{"rendered":"http:\/\/bitc.bme.emory.edu\/~lzhou\/blogs\/?p=69"},"modified":"2011-01-06T13:36:09","modified_gmt":"2011-01-06T17:36:09","slug":"rhel5-yum-update-works-but-pup-and-yum-list-security-does-not","status":"publish","type":"post","link":"https:\/\/csic.som.emory.edu\/~lzhou\/blogs\/?p=69","title":{"rendered":"RHEL5 &#8211; yum update works but pup and yum list-security does not"},"content":{"rendered":"<p>The RHEL5 machines under my administration experienced an interesting error.\u00a0 If running pup, whenever there are updates exist, it crashes with the error:<\/p>\n<pre>SyntaxError: not well-formed (invalid token)<\/pre>\n<p>The error message will be things like<\/p>\n<pre># yum list-security\r\nLoading \"rhnplugin\" plugin\r\nLoading \"security\" plugin\r\nSetting up repositories\r\nrhel-i386-server-cluster- 100% |=========================| 1.4 kB    00:00\r\nrhel-i386-server-5        100% |=========================| 1.4 kB    00:00\r\nrhel-i386-server-vt-5     100% |=========================| 1.4 kB    00:00\r\nrhel-i386-server-cluster- 100% |=========================| 1.4 kB    00:00\r\nrhel-i386-server-suppleme 100% |=========================| 1.2 kB    00:00\r\nrhn-tools-rhel-i386-serve 100% |=========================| 1.2 kB    00:00\r\nReading repository metadata in from local files\r\nTraceback (most recent call last):\r\n  File \"\/usr\/bin\/yum\", line 29, in ?\r\n    yummain.main(sys.argv[1:])\r\n  File \"\/usr\/share\/yum-cli\/yummain.py\", line 102, in main\r\n    result, resultmsgs = do()\r\n  File \"\/usr\/share\/yum-cli\/cli.py\", line 359, in doCommands\r\n    return self.yum_cli_commands[self.basecmd].doCommand(self, self.basecmd,\r\nself.extcmds)\r\n  File \"\/usr\/lib\/yum-plugins\/security.py\", line 193, in doCommand\r\n    md_info = ysp_gen_metadata(self)\r\n  File \"\/usr\/lib\/yum-plugins\/security.py\", line 58, in ysp_gen_metadata\r\n    md_info.add(repo)\r\n  File \"\/usr\/lib\/python2.4\/site-packages\/yum\/update_md.py\", line 235, in add\r\n    for event, elem in iterparse(infile):\r\n  File \"&lt;string&gt;\", line 64, in __iter__\r\nSyntaxError: not well-formed (invalid token): line 767, column 15<\/pre>\n<p>RedHat Bug 428819 at<br \/>\nhttps:\/\/bugzilla.redhat.com\/show_bug.cgi?id=428819<br \/>\nand Bug 470932 at<br \/>\nhttps:\/\/bugzilla.redhat.com\/show_bug.cgi?id=470932<br \/>\nexplained it as &#8220;unescaped &#8216;&amp;&#8217;, &#8216;&lt;&#8216;, &#8216;&gt;&#8217; in updateinfo.xml and failing yum-security plugin&#8221;<br \/>\nand released an errata at<br \/>\nhttp:\/\/rhn.redhat.com\/errata\/RHBA-2008-1005.html<\/p>\n<p>However, this errata does not work on my boxes since they are not Network Satellite.<\/p>\n<p>By understanding the detail of the error, a custom fix can be done in the following way:<\/p>\n<p>[root@mybox ~]cd \/usr\/lib\/python2.4\/site-packages\/yum<br \/>\n[root@mybox yum]nano +376 update_md.py<\/p>\n<p>and insert the following part:<\/p>\n<pre>        buffile = open('\/root\/pup.buf', 'w')\r\n        for line in infile:\r\n            if \"&lt;domain&gt;\" in line:\r\n                line = line.replace('&lt;domain&gt;', '[domain]')\r\n            if \"&lt;pid&gt;\" in line:\r\n                line = line.replace('&lt;pid&gt;', '[pid]')\r\n            if \"&lt;dev&gt;\" in line:\r\n                line = line.replace('&lt;dev&gt;', '[dev]')\r\n            if \"&lt;device&gt;\" in line:\r\n                line = line.replace('&lt;device&gt;', '[device]')\r\n            if \"&lt;head&gt;\" in line:\r\n                line = line.replace('&lt;head&gt;', '[head]')\r\n            if \"&lt;Unknown&gt;\" in line:\r\n                line = line.replace('&lt;Unknown&gt;', '[Unknown]')\r\n            if \"&lt;Shift&gt;\" in line:\r\n                line = line.replace('&lt;Shift&gt;', '[Shift]')\r\n            if \"&lt;Tab&gt;\" in line:\r\n                line = line.replace('&lt;Tab&gt;', '[Tab]')\r\n            if \"&lt;Directory&gt;\" in line:\r\n                line = line.replace('&lt;Directory&gt;', '[Directory]')\r\n            if \"&lt;locale&gt;\" in line:\r\n                line = line.replace('&lt;locale&gt;', '[locale]')\r\n            if \"&lt;source&gt;\" in line:\r\n                line = line.replace('&lt;source&gt;', '[source]')\r\n            if \"&lt;dest&gt;\" in line:\r\n                line = line.replace('&lt;dest&gt;', '[dest]')\r\n            if \"&lt;file&gt;\" in line:\r\n                line = line.replace('&lt;file&gt;', '[file]')\r\n            if \"&lt;NUM&gt;\" in line:\r\n                line = line.replace('&lt;NUM&gt;', '[NUM]')\r\n            if \"&lt;path_to_file&gt;\" in line:\r\n                line = line.replace('&lt;path_to_file&gt;', '[path_to_file]')\r\n            if \"&lt;TD&gt;\" in line:\r\n                line = line.replace('&lt;TD&gt;', '[TD]')\r\n            if \"&lt;Target\" in line:\r\n                line = line.replace('&lt;Target', '[Target')\r\n            if \"Tag&gt;\" in line:\r\n                line = line.replace('Tag&gt;', 'Tag]')\r\n            if \"&amp;\" in line:\r\n                line = line.replace('&amp;', 'a')\r\n            if \"&lt;&lt;\" in line:\r\n                line = line.replace('&lt;&lt;', '[[')\r\n            if \"&gt;&gt;\" in line:\r\n                line = line.replace('&gt;&gt;', ']]')\r\n            if \" &lt; \" in line:\r\n                line = line.replace(' &lt; ', ' lt ')\r\n            if \" &gt; \" in line:\r\n                line = line.replace(' &gt; ', ' gt ')\r\n            buffile.write(line)\r\n        buffile.close()\r\n        infile = open('\/root\/pup.buf', 'rt')<\/pre>\n<p>in between<\/p>\n<pre>            infile = obj<\/pre>\n<p>and<\/p>\n<pre>        for event, elem in iterparse(infile):<\/pre>\n<p>This will restore the proper operation of pup and yum list-security.<\/p>\n<p>PS. The list has grown too long.  The working update_md.py files is <a href=\"http:\/\/bitc.bme.emory.edu\/~lzhou\/files\/update_md.py\">here<\/a>.<\/p>\n<p>If it does not work, you can check the error and put in more replacement filters.<\/p>\n<p>Enjoy.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The RHEL5 machines under my administration experienced an interesting error.\u00a0 If running pup, whenever there are updates exist, it crashes with the error: SyntaxError: not well-formed (invalid token) The error message will be things like # yum list-security Loading &#8220;rhnplugin&#8221; plugin Loading &#8220;security&#8221; plugin Setting up repositories rhel-i386-server-cluster- 100% |=========================| 1.4 kB 00:00 rhel-i386-server-5 100% [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10,21],"tags":[],"class_list":["post-69","post","type-post","status-publish","format-standard","hentry","category-my-father-collected-a-few-chinese-antiques-as-shown-here","category-computer-tips","post-blog"],"_links":{"self":[{"href":"https:\/\/csic.som.emory.edu\/~lzhou\/blogs\/index.php?rest_route=\/wp\/v2\/posts\/69","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/csic.som.emory.edu\/~lzhou\/blogs\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/csic.som.emory.edu\/~lzhou\/blogs\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/csic.som.emory.edu\/~lzhou\/blogs\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/csic.som.emory.edu\/~lzhou\/blogs\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=69"}],"version-history":[{"count":0,"href":"https:\/\/csic.som.emory.edu\/~lzhou\/blogs\/index.php?rest_route=\/wp\/v2\/posts\/69\/revisions"}],"wp:attachment":[{"href":"https:\/\/csic.som.emory.edu\/~lzhou\/blogs\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=69"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/csic.som.emory.edu\/~lzhou\/blogs\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=69"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/csic.som.emory.edu\/~lzhou\/blogs\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=69"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}