[Bug 588679] New: yast2-printer: AutoYaST client destroys information in cupsd.conf
http://bugzilla.novell.com/show_bug.cgi?id=588679 http://bugzilla.novell.com/show_bug.cgi?id=588679#c0 Summary: yast2-printer: AutoYaST client destroys information in cupsd.conf Classification: openSUSE Product: openSUSE 11.3 Version: Factory Platform: All OS/Version: openSUSE 11.3 Status: NEEDINFO Severity: Major Priority: P5 - None Component: AutoYaST AssignedTo: jsmeix@novell.com ReportedBy: jsmeix@novell.com QAContact: qa@suse.de CC: ug@novell.com, mzugec@novell.com Found By: Development Blocker: --- When AutoYaST calls the "Write" function in printer_auto.ycp it results - a /etc/cups/cupsd.conf without any comments and without any indentation but with a strange unexpected re-ordering of the entries and - a /etc/cups/client.conf without any comments which is totally empty if there was no active entry in the /etc/cups/client.conf of the system wherefrom the AutoYaST control file was created. Because the comments provide useful and sometimes even very important information for the admin, the yast2-printer AutoYaST client destroys information. Because the ordering in /etc/cups/cupsd.conf in the cloned system is the well known upstream ordering, an unexpected strange re-ordering makes it very hard to understand the /etc/cups/cupsd.conf file afterwards. Therefore the bug severity is "major". Details: When AutoYaST calls the "Write" function in printer_auto.ycp it calls Printerlib::WriteClientSettings and Printerlib::WriteCupsSettings which call SCR::Write(.cups.client, ay) and SCR::Write(.cups.server, ay) where ay is a map as follows: ------------------------------------------------------------------------ $["cups_remote_server": $[], "server_settings": $["BrowseAllow":["all"], "BrowseOrder":["allow,deny"], "Browsing":["On"], "DefaultAuthType":["Basic"], "DefaultPolicy":["default"], "Listen":["localhost:631", "/var/run/cups/cups.sock"], "LogLevel":["info"], "SystemGroup":["sys root"], .. ------------------------------------------------------------------------ and the /etc/cups/cupsd.conf file is as follows: ------------------------------------------------------------------------ Listen localhost:631 Listen /var/run/cups/cups.sock Browsing On BrowseOrder allow,deny BrowseAllow none BrowseDeny all DefaultPolicy default DefaultAuthType Basic SystemGroup sys root .. LogLevel info ------------------------------------------------------------------------ I assume because a YCP map does not keep any ordering but the actual sequence of its entries is random, one gets also a random re-ordered cupds.conf file written. Uwe, for openSUSE 11.3 I will clean it up, compare https://bugzilla.novell.com/show_bug.cgi?id=582680#c35 Which YCP structure works for AutoYaST so that config files are written 100% identical on the target system? I.e. on one same system "Read"->"Export"->"Import"->"Write" must result 100% identical (i.e. unchanged) config files. I would prefer to have both cupsd.conf and client.conf as XML CDATA in the AutoYaST control file. Which YCP data must the "Export" function in printer_auto.ycp provide to AutoYaST so that the result are two XML CDATA sections, one for cupsd.conf and one for client.conf? -- Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
http://bugzilla.novell.com/show_bug.cgi?id=588679 http://bugzilla.novell.com/show_bug.cgi?id=588679#c Johannes Meixner <jsmeix@novell.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Priority|P5 - None |P3 - Medium -- Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
http://bugzilla.novell.com/show_bug.cgi?id=588679 http://bugzilla.novell.com/show_bug.cgi?id=588679#c1 Uwe Gansert <ug@novell.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEEDINFO |NEW Info Provider|ug@novell.com | --- Comment #1 from Uwe Gansert <ug@novell.com> 2010-03-16 15:19:32 UTC --- the following keys will be CDATA: source, info_file, file_contents, pxelinux-config, media_url, location, script_source for your case "source" or "file_contents" might be the best -- Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
http://bugzilla.novell.com/show_bug.cgi?id=588679 http://bugzilla.novell.com/show_bug.cgi?id=588679#c2 Johannes Meixner <jsmeix@novell.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |NEEDINFO Info Provider| |ug@novell.com --- Comment #2 from Johannes Meixner <jsmeix@novell.com> 2010-03-16 15:37:39 UTC --- I don't know about a documentation about the structure of the map for AutoYaST and possible allowed/reserved keys. I only know about http://forgeftp.novell.com/yast/doc/SL11.1/autoinstall/devel/ar01s06.html but there is no example but from http://forgeftp.novell.com/yast/doc/SL11.1/autoinstall/devel/ar01s03.html I guess you mean the following map as a result of "Export": $["cups_remote_server": $[ "file_contents": "string which contains the content of /etc/cups/client.conf" ], "server_settings": $[ "file_contents": "string which contains the content of /etc/cups/cupds.conf" ] ] -- Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
http://bugzilla.novell.com/show_bug.cgi?id=588679 http://bugzilla.novell.com/show_bug.cgi?id=588679#c3 Uwe Gansert <ug@novell.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEEDINFO |NEW Info Provider|ug@novell.com | --- Comment #3 from Uwe Gansert <ug@novell.com> 2010-03-16 15:56:06 UTC --- there are no reserved keys and everything is allowed (as long as it's XML conform). Your example for CDATA sections is correct. If you need/want a new key for CDATA, I have to add that to the autoyast code. -- Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
http://bugzilla.novell.com/show_bug.cgi?id=588679 http://bugzilla.novell.com/show_bug.cgi?id=588679#c4 --- Comment #4 from Johannes Meixner <jsmeix@novell.com> 2010-03-16 16:27:18 UTC --- Implemented it right now as follows in printer_auto.ycp for a very first test ----------------------------------------------------------------------------- else if (func == "Export") { ret = $[ "cupsd_conf_content" : $[ "file_contents" : (string)SCR::Read( .target.string, "/etc/cups/cupsd.conf" ) ], "client_conf_content" : $[ "file_contents" : (string)SCR::Read( .target.string, "/etc/cups/client.conf" ) ] ]; } .. else if (func == "Write") { y2milestone("Writing to system '%1'", Printer::autoyast_printer_settings); SCR::Write( .target.string, "/etc/cups/cupsd.conf", Printer::autoyast_printer_settings["cupsd_conf_content", "file_contents"]:"" ); SCR::Write( .target.string, "/etc/cups/client.conf", Printer::autoyast_printer_settings["client_conf_content", "file_contents"]:"" ); return true; } ----------------------------------------------------------------------------- and - guess what - it seems to work perfectly - at least for me! I have both an easy to understand XML and no longer destroyed information or any other unexpected change of my config files and furthermore much less code which implements this all. KISS! -- Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
http://bugzilla.novell.com/show_bug.cgi?id=588679 http://bugzilla.novell.com/show_bug.cgi?id=588679#c Johannes Meixner <jsmeix@novell.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED -- Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
http://bugzilla.novell.com/show_bug.cgi?id=588679 http://bugzilla.novell.com/show_bug.cgi?id=588679#c5 --- Comment #5 from Johannes Meixner <jsmeix@novell.com> 2010-03-17 08:29:56 UTC --- The now obsolete implementations of Printerlib::WriteClientSettings and Printerlib::WriteCupsSettings --------------------------------------------------------------------------- global boolean WriteCupsSettings(map ay){ string cups_file="/etc/cups/cupsd.conf"; y2milestone("Create backup of %1 file:%2", cups_file, SCR::Execute(.target.bash, sformat("mv %1 %1.$(date -I)", cups_file))); SCR::Write(.cups.server, ay); return true; } --------------------------------------------------------------------------- are broken because: - Those functions call /bin/mv to "Create backup" (of course without any error check afterwards) but if the subsequent SCR::Write fails, there might be no longer a /etc/cups/cupsd.conf file because it was moved away (to make a backup "cp -p ..." is a correct way) and - if the subsequent SCR::Write is succesful, it runs the Perl script in agents/ag_cups but I don't see any kind of owner/group and permission settings in agents/ag_cups. It just blindly writes a /etc/cups/cupsd.conf file with whatever unpredictable owner/group and permissions of the user who currently runs it. Usually owner/group is root/root which is wong because for /etc/cups/cupsd.conf it should be root/lp and the permissions are usually -rw-r--r-- (depending on the umask of the user who currently runs it) which is totally wrong. It should be -rw-r----- because world-wide read permissions for whatever passwords therein (in particular a possible BrowseLDAPPassword value) is even a security bug! Therefore I will remove Printerlib::WriteClientSettings and Printerlib::WriteCupsSettings and all those stuff in the agents/ sub-directory. -- Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
http://bugzilla.novell.com/show_bug.cgi?id=588679 http://bugzilla.novell.com/show_bug.cgi?id=588679#c6 --- Comment #6 from Johannes Meixner <jsmeix@novell.com> 2010-03-17 11:02:57 UTC --- Created an attachment (id=348871) --> (http://bugzilla.novell.com/attachment.cgi?id=348871) yast2-printer source src/printer.rnc Uwe, the attached current src/printer.rnc is outdated and would be wrong for my above changes for openSUSE 11.3. I would also like to clean this up totally, i.e. remove any outdated stuff from it and have only therein what is valid for my above changes for openSUSE 11.3. I think src/printer.rnc should become something like -------------------------------------------------------------------------- default namespace = "http://www.suse.com/1.0/yast2ns" namespace a = "http://relaxng.org/ns/compatibility/annotations/1.0" namespace config = "http://www.suse.com/1.0/configns" printer = element printer { element cupsd_conf_content { Anything* }? & element client_conf_content { Anything* }? } -------------------------------------------------------------------------- But instead of "Anything*" I would prefer a more specific entry which describes that the content is actually a map with one single key "file_contents" and its value is a string which contains CDATA, see comment #4. -- Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
http://bugzilla.novell.com/show_bug.cgi?id=588679 http://bugzilla.novell.com/show_bug.cgi?id=588679#c Johannes Meixner <jsmeix@novell.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |NEEDINFO Info Provider| |ug@novell.com -- Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
http://bugzilla.novell.com/show_bug.cgi?id=588679 http://bugzilla.novell.com/show_bug.cgi?id=588679#c7 --- Comment #7 from Johannes Meixner <jsmeix@novell.com> 2010-03-17 11:06:30 UTC --- Created an attachment (id=348872) --> (http://bugzilla.novell.com/attachment.cgi?id=348872) New AutoYaST printer control file Here an AutoYaST printer control file which is the result after my changes in comment #4 -- Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
http://bugzilla.novell.com/show_bug.cgi?id=588679 http://bugzilla.novell.com/show_bug.cgi?id=588679#c8 --- Comment #8 from Johannes Meixner <jsmeix@novell.com> 2010-03-18 10:22:09 UTC --- FYI: Regarding XML schema, I filed the related bug #588998 (yast2-schema: no element "printer" in profile.rng). -- Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
http://bugzilla.novell.com/show_bug.cgi?id=588679 http://bugzilla.novell.com/show_bug.cgi?id=588679#c9 Uwe Gansert <ug@novell.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEEDINFO |ASSIGNED Info Provider|ug@novell.com | --- Comment #9 from Uwe Gansert <ug@novell.com> 2010-03-18 14:33:32 UTC --- printer = element printer { element cupsd_conf_content { element file_contents { text }? }? & element client_conf_content { element file_contents { text }? }? } that should be fine -- Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
http://bugzilla.novell.com/show_bug.cgi?id=588679 http://bugzilla.novell.com/show_bug.cgi?id=588679#c10 Johannes Meixner <jsmeix@novell.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |NEEDINFO Info Provider| |ug@novell.com --- Comment #10 from Johannes Meixner <jsmeix@novell.com> 2010-03-18 14:45:16 UTC --- Committed the following to YaST SVN trunk revision r61386: Cleaned up the AutoYaST printer client up to comment #5 which means: Now there is verbatim cupsd.conf and client.conf as XML CDATA in the AutoYaST control file. The new AutoYaST map for printer settings is ----------------------------------------------------------- $[ "cupsd_conf_content" : $[ "file_contents" : "string content of /etc/cups/cupds.conf" ], "client_conf_content" : $[ "file_contents" : "string content of /etc/cups/client.conf" ] ] ----------------------------------------------------------- This results the new AutoYaST control file structure ----------------------------------------------------------- <printer> <client_conf_content> <file_contents><![CDATA[ .. verbatim content of /etc/cups/client.conf ... ]]></file_contents> </client_conf_content> <cupsd_conf_content> <file_contents><![CDATA[ .. verbatim content of /etc/cups/cupsd.conf ... ]]></file_contents> </cupsd_conf_content> </printer> ----------------------------------------------------------- Read and write of /etc/cups/cupsd.conf and /etc/cups/client.conf is now implemented directly in printer_auto.ycp via SCR::Read( .target.string, ... ) and SCR::Write( .target.string, ... ). No longer needed and therefore removed are Printerlib::WriteClientSettings and Printerlib::WriteCupsSettings all what there was in the agents/ sub-directory. -- Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
http://bugzilla.novell.com/show_bug.cgi?id=588679 http://bugzilla.novell.com/show_bug.cgi?id=588679#c11 Johannes Meixner <jsmeix@novell.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEEDINFO |ASSIGNED Info Provider|ug@novell.com | --- Comment #11 from Johannes Meixner <jsmeix@novell.com> 2010-03-18 14:47:13 UTC --- Regarding comment #9: Thanks for the info! I will commit an accordingly updated src/printer.rnc soon to the YaST SVN trunk. -- Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
http://bugzilla.novell.com/show_bug.cgi?id=588679 http://bugzilla.novell.com/show_bug.cgi?id=588679#c12 Johannes Meixner <jsmeix@novell.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |NEEDINFO Info Provider| |ug@novell.com --- Comment #12 from Johannes Meixner <jsmeix@novell.com> 2010-03-18 14:52:58 UTC --- Does the ordering of the entries in printer.rnc matter? I ask because according to attachment #348872 the ordering in the AutoYaST control file is first the <client_conf_content> then the <cupsd_conf_content> but the ordering in printer.rnc is the opposite. -- Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
http://bugzilla.novell.com/show_bug.cgi?id=588679 http://bugzilla.novell.com/show_bug.cgi?id=588679#c13 Uwe Gansert <ug@novell.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEEDINFO |ASSIGNED Info Provider|ug@novell.com | --- Comment #13 from Uwe Gansert <ug@novell.com> 2010-03-18 15:13:39 UTC --- the order does not matter if you use "&". It would matter if you'd use "," -- Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
http://bugzilla.novell.com/show_bug.cgi?id=588679 http://bugzilla.novell.com/show_bug.cgi?id=588679#c14 Johannes Meixner <jsmeix@novell.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |RESOLVED Resolution| |FIXED --- Comment #14 from Johannes Meixner <jsmeix@novell.com> 2010-03-18 15:14:46 UTC --- Finished clean-up of AutoYST printer client: In src/printer.desktop added the line X-SuSE-YaST-AutoInstSchema=printer.rnc to pull in printer.rnc when yast2-schema is build which fixes bug #588998. Finally cleaned up src/printer.rnc according to comment #9 but with the opposite ordering to be on the safe side (see comment #12) as follows: ----------------------------------------------------------------------- default namespace = "http://www.suse.com/1.0/yast2ns" namespace a = "http://relaxng.org/ns/compatibility/annotations/1.0" namespace config = "http://www.suse.com/1.0/configns" printer = element printer { element client_conf_content { element file_contents { text }? }? & element cupsd_conf_content { element file_contents { text }? }? } ----------------------------------------------------------------------- so that now this bug #588679 is hopefully fixed completely. Committed to YaST SVN trunk revision r61387. -- Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
http://bugzilla.novell.com/show_bug.cgi?id=588679 http://bugzilla.novell.com/show_bug.cgi?id=588679#c15 --- Comment #15 from Johannes Meixner <jsmeix@novell.com> 2010-03-18 15:16:24 UTC --- Thanks for the info in comment #13 (I didn't see it because of Bugzilla mid-air collision). -- Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
http://bugzilla.novell.com/show_bug.cgi?id=588679 http://bugzilla.novell.com/show_bug.cgi?id=588679#c16 --- Comment #16 from Johannes Meixner <jsmeix@novell.com> 2010-03-23 09:46:51 UTC --- Checked in into YaST:Head with submitrequest #35289 and afterwards submitted to openSUSE:Factory with submitrequest #35521 -- Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
http://bugzilla.novell.com/show_bug.cgi?id=588679 http://bugzilla.novell.com/show_bug.cgi?id=588679#c17 --- Comment #17 from Bernhard Wiedemann <bwiedemann@suse.com> --- This is an autogenerated message for OBS integration: This bug (588679) was mentioned in https://build.opensuse.org/request/show/35521 Factory / yast2-printer -- You are receiving this mail because: You are on the CC list for the bug.
participants (1)
-
bugzilla_noreply@novell.com