<?xml version="1.0" encoding="UTF-8" ?>

<bugzilla version="5.2"
          urlbase="https://bugzilla.altlinux.org/"
          
          maintainer="jenya@basealt.ru"
>

    <bug>
          <bug_id>33714</bug_id>
          
          <creation_ts>2017-08-01 18:59:23 +0300</creation_ts>
          <short_desc>shell-ini-config добавляет пустую строку в конец файла</short_desc>
          <delta_ts>2017-08-03 13:04:34 +0300</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>4</classification_id>
          <classification>Development</classification>
          <product>Sisyphus</product>
          <component>libshell</component>
          <version>unstable</version>
          <rep_platform>all</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>CLOSED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P3</priority>
          <bug_severity>minor</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="manowar@altlinux.org">manowar</reporter>
          <assigned_to name="Alexey Gladkov">legion</assigned_to>
          <cc>glebfm</cc>
    
    <cc>legion</cc>
          
          <qa_contact>qa-sisyphus</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>164965</commentid>
    <comment_count>0</comment_count>
    <who name="manowar@altlinux.org">manowar</who>
    <bug_when>2017-08-01 18:59:23 +0300</bug_when>
    <thetext>При удалении одной или всех переменных из секции в конец файла добавляется пустая строка. Новые секции и переменные добавляются уже *после* этой путой строки. В результате, после многих вызовов ini_config_set и ini_config_del, файл получается очень разряженным — человеку его потом редактировать крайне неудобно.

$ echo &apos;[mysection]&apos; &gt;test.ini
$ echo &apos;myvar = myval&apos; &gt;&gt;test.ini
$ cat test.ini 
[mysection]
myvar = myval
$ . shell-ini-config
$ ini_config_del test.ini mysection
$ cat test.ini 
[mysection]

$ rpm -qf /bin/shell-ini-config
libshell-0.4.1-alt1


Workaround:
Помогает sed -i -e &apos;$ { /^$/ d }&apos; &quot;$CONFIG&quot; после каждого вызова ini_config_del.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>164982</commentid>
    <comment_count>1</comment_count>
    <who name="Alexey Gladkov">legion</who>
    <bug_when>2017-08-02 12:11:11 +0300</bug_when>
    <thetext>Хорошо подметили. Я нашёл ещё одну багу в этом модуле. Спасибо.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>165012</commentid>
    <comment_count>2</comment_count>
    <who name="Repository Robot">repository-robot</who>
    <bug_when>2017-08-03 13:04:34 +0300</bug_when>
    <thetext>libshell-0.4.3-alt1 -&gt; sisyphus:

Thu Aug 03 2017 Alexey Gladkov &lt;legion@altlinux.ru&gt; 0.4.3-alt1
- New version (0.4.3).
- shell-ini-config changes:
  + Do not add new line after deletion (ALT#33714).
  + Preserve spaces in comments.
- shell-git-config changes:
  + Add includeIf support.
- shell-var changes:
  + Add shell_var_is_number.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>