juhp / fbrnch

Tool to update fedora packages branches

Home Page:https://hackage.haskell.org/package/fbrnch

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Clean input before asking for update notes

LyesSaadi opened this issue · comments

Hello!

This is quite a common issue with cli apps.

So, basically, what happened is that I got this update summary in emails recently:

================================================================================
     FEDORA-2021-397e903340
================================================================================
    Release: Fedora 34
     Status: pending
       Type: enhancement
   Severity: unspecified
      Karma: 0
    Request: testing
      Notes: �[A�[A�[A�[A�[A�[A�[A�[A�[A�[A�[A�[A�[A�[A�[A�[A�[A�[A�[A�[A�[A�[A�
           : [A�[A�[A�[A�[B
  Submitter: lyessaadi
  Submitted: 2021-04-20 23:25:31.498306
   Comments: bodhi - 2021-04-20 23:25:31.960843 (karma 0)
             This update has been submitted for testing by
             lyessaadi.

Looking at the Notes, something was clearly wrong :P! What happened, is that I pressed the UP key before the input came, so this printed out those characters (which are similar to when you do [CTRL]+[C], no idea how they are called). Anyway, when it then asked for input for the notes, it took those characters as the answer. So, before asking for the Notes, fbrnch did not clear its input buffer and took the previous characters as an answer which printed out those weird notes.

Granted, with �[A, it is pretty unlikely to happen to anyone, since this is solved for most terminal nowadays (this happened on the nvim terminal, btw). But, this still an issue if someone just mistakenly presses a key, like "B", before the prompt and when the prompt shows up, just presses [ENTER] thinking nothing was given.

No idea how to solve this in Haskell though.

Okay thanks for the report - will look into it 👍

Finally released today in fbrnch-0.9