Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH 0/1] Make "File exists" exit w/ non-zero status
       [not found] <20240712232334.87395-1-dabe@dabe.com>
@ 2024-07-15 12:55 ` Dabrien 'Dabe' Murphy
       [not found] ` <20240712232334.87395-2-dabe@dabe.com>
  1 sibling, 0 replies; 7+ messages in thread
From: Dabrien 'Dabe' Murphy @ 2024-07-15 12:55 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Dabrien 'Dabe' Murphy

I'm not sure if it was by design or just an oversight, but it seems
"unexpected" that ffmpeg (without `-y`) to an existing file calls
`exit(0)`, even though it prints a "fatal" error...

The attached patch itself is trivial, but like I say, maybe there was
a reason for the current behavior that I'm just not aware of.

Cheers!


dabe (1):
   fftools/ffmpeg_opt: Exit with non-zero status when destination exists

  fftools/ffmpeg_opt.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

-- 2.45.2

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [FFmpeg-devel] [PATCH 1/1] fftools/ffmpeg_opt: Exit with non-zero status when destination exists
       [not found] ` <20240712232334.87395-2-dabe@dabe.com>
@ 2024-07-15 12:56   ` Dabrien 'Dabe' Murphy
  2024-07-15 13:25     ` Gyan Doshi
  0 siblings, 1 reply; 7+ messages in thread
From: Dabrien 'Dabe' Murphy @ 2024-07-15 12:56 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Dabrien 'Dabe' Murphy

---
  fftools/ffmpeg_opt.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index 2c201c74b2..dddf7c6475 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -604,13 +604,13 @@ int assert_file_overwrite(const char *filename)
                  signal(SIGINT, SIG_DFL);
                  if (!read_yesno()) {
                      av_log(NULL, AV_LOG_FATAL, "Not overwriting - exiting\n");
-                    return AVERROR_EXIT;
+                    return AVERROR(EEXIST);
                  }
                  term_init();
              }
              else {
                  av_log(NULL, AV_LOG_FATAL, "File '%s' already exists. Exiting.\n", filename);
-                return AVERROR_EXIT;
+                return AVERROR(EEXIST);
              }
          }
      }
-- 2.45.2

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [FFmpeg-devel] [PATCH 1/1] fftools/ffmpeg_opt: Exit with non-zero status when destination exists
  2024-07-15 12:56   ` [FFmpeg-devel] [PATCH 1/1] fftools/ffmpeg_opt: Exit with non-zero status when destination exists Dabrien 'Dabe' Murphy
@ 2024-07-15 13:25     ` Gyan Doshi
  2024-07-16  4:10       ` Marth64
  0 siblings, 1 reply; 7+ messages in thread
From: Gyan Doshi @ 2024-07-15 13:25 UTC (permalink / raw)
  To: ffmpeg-devel



On 2024-07-15 06:26 pm, Dabrien 'Dabe' Murphy wrote:
> ---
>  fftools/ffmpeg_opt.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
> index 2c201c74b2..dddf7c6475 100644
> --- a/fftools/ffmpeg_opt.c
> +++ b/fftools/ffmpeg_opt.c
> @@ -604,13 +604,13 @@ int assert_file_overwrite(const char *filename)
>                  signal(SIGINT, SIG_DFL);
>                  if (!read_yesno()) {
>                      av_log(NULL, AV_LOG_FATAL, "Not overwriting - 
> exiting\n");
> -                    return AVERROR_EXIT;
> +                    return AVERROR(EEXIST);
>                  }
>                  term_init();
>              }
>              else {
>                  av_log(NULL, AV_LOG_FATAL, "File '%s' already exists. 
> Exiting.\n", filename);
> -                return AVERROR_EXIT;
> +                return AVERROR(EEXIST);

The former is not an error. The user was asked and the application 
behaved as per their reply.

Regards,
Gyan

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [FFmpeg-devel] [PATCH 1/1] fftools/ffmpeg_opt: Exit with non-zero status when destination exists
  2024-07-15 13:25     ` Gyan Doshi
@ 2024-07-16  4:10       ` Marth64
  2024-07-16  5:07         ` Gyan Doshi
  0 siblings, 1 reply; 7+ messages in thread
From: Marth64 @ 2024-07-16  4:10 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

Gyan:
> The former is not an error. The user was asked and the application
> behaved as per their reply.
Could it make sense to only return the AVERROR(EEXIST) if -nostdin is
passed (otherwise current behavior)?
I have observed this behavior too and think it's strange only in the
-nostdin case.
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [FFmpeg-devel] [PATCH 1/1] fftools/ffmpeg_opt: Exit with non-zero status when destination exists
  2024-07-16  4:10       ` Marth64
@ 2024-07-16  5:07         ` Gyan Doshi
  2025-02-05 16:14           ` Marth64
  0 siblings, 1 reply; 7+ messages in thread
From: Gyan Doshi @ 2024-07-16  5:07 UTC (permalink / raw)
  To: ffmpeg-devel



On 2024-07-16 09:40 am, Marth64 wrote:
> Gyan:
>> The former is not an error. The user was asked and the application
>> behaved as per their reply.
> Could it make sense to only return the AVERROR(EEXIST) if -nostdin is
> passed (otherwise current behavior)?

Agreed.

Regards,
Gyan

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [FFmpeg-devel] [PATCH 1/1] fftools/ffmpeg_opt: Exit with non-zero status when destination exists
  2024-07-16  5:07         ` Gyan Doshi
@ 2025-02-05 16:14           ` Marth64
  2025-02-06  3:59             ` Leo Izen
  0 siblings, 1 reply; 7+ messages in thread
From: Marth64 @ 2025-02-05 16:14 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

> On 2024-07-16 09:40 am, Marth64 wrote:
> > Gyan:
> >> The former is not an error. The user was asked and the application
> >> behaved as per their reply.
> > Could it make sense to only return the AVERROR(EEXIST) if -nostdin is
> > passed (otherwise current behavior)?
>
> Agreed.

Planning to send a patch for this in the next few days. Thank you.
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [FFmpeg-devel] [PATCH 1/1] fftools/ffmpeg_opt: Exit with non-zero status when destination exists
  2025-02-05 16:14           ` Marth64
@ 2025-02-06  3:59             ` Leo Izen
  0 siblings, 0 replies; 7+ messages in thread
From: Leo Izen @ 2025-02-06  3:59 UTC (permalink / raw)
  To: ffmpeg-devel

On 2/5/25 11:14 AM, Marth64 wrote:
>> behaved as per their reply.
> Could it make sense to only return the AVERROR(EEXIST) if -nostdin is

If you do, you should consider not just -nostdin but also if reading 
from stdin like a pipe, e.g. ffmpeg -i - .... foo.mkv
this will exit with success if foo.mkv exists without asking on stdin 
(as you'd expect it to not, cause it's reading from stdin)

- Leo Izen (Traneptora)


_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2025-02-06  4:00 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20240712232334.87395-1-dabe@dabe.com>
2024-07-15 12:55 ` [FFmpeg-devel] [PATCH 0/1] Make "File exists" exit w/ non-zero status Dabrien 'Dabe' Murphy
     [not found] ` <20240712232334.87395-2-dabe@dabe.com>
2024-07-15 12:56   ` [FFmpeg-devel] [PATCH 1/1] fftools/ffmpeg_opt: Exit with non-zero status when destination exists Dabrien 'Dabe' Murphy
2024-07-15 13:25     ` Gyan Doshi
2024-07-16  4:10       ` Marth64
2024-07-16  5:07         ` Gyan Doshi
2025-02-05 16:14           ` Marth64
2025-02-06  3:59             ` Leo Izen

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git